HI Can anyone help

I have a workbook with a date picker in a few cells with code, all works perfect, however when I click on the cell I can input any data and when I click out of the cell it errors out.

if I click on the data picker dates its all ok.

What I would like to do is lock the cell so only a date from the date picker will be shown, or even a msb box saying input error please input correct date


Can anyone help me on theis. Here is the code that im using


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  
  With Sheet4.DTPicker2
    .Height = 20
    .Width = 20
    'If Not Intersect(Target, Range("A:A")) Is Nothing Then
    If Not Application.Intersect(Range("b20,b23,d26,e26,e27,d27,b49,b51"), Target) Is Nothing Then
      .Visible = True
      .Top = Target.Top
      .Left = Target.Offset(0, 1).Left
      .LinkedCell = Target.Address
    Else
      .Visible = False
    End If
  End With
      
End Sub