Robandemmy
Board Regular
- Joined
- Jul 16, 2018
- Messages
- 65
I wanted to ease the input of dates for some employees in a shop. There are 4 columns that require date inputs: G, H, J and K. I added one date picker for columns G:H and another one for J:K with the following code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Sheet18.DTPicker1
.Height = 20
.Width = 20
If Not Intersect(Target, Range("G4:H9999")) Is Nothing Then
.Visible = True
.Top = Target.Top
.Left = Target.Offset(0, 1).Left
.LinkedCell = Target.Address
Else
.Visible = False
End If
End With
With Sheet18.DTPicker2
.Height = 20
.Width = 20
If Not Intersect(Target, Range("J4:K9999")) 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
I cannot find how to turn off the time stamp display, I would like just DD/MM/YYYY. Cell formatting does not do anything. Strangely enough, as I am testing this as I write this post, J:K are displayed as I wish, G:H are not.
Also of note, my knowledge is < a newbie when it comes to VBAs, I think I got this code from a youtube clip. The code sometimes fails and causes an error that I am trying to recreate.
Any help is appreciated.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Sheet18.DTPicker1
.Height = 20
.Width = 20
If Not Intersect(Target, Range("G4:H9999")) Is Nothing Then
.Visible = True
.Top = Target.Top
.Left = Target.Offset(0, 1).Left
.LinkedCell = Target.Address
Else
.Visible = False
End If
End With
With Sheet18.DTPicker2
.Height = 20
.Width = 20
If Not Intersect(Target, Range("J4:K9999")) 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
I cannot find how to turn off the time stamp display, I would like just DD/MM/YYYY. Cell formatting does not do anything. Strangely enough, as I am testing this as I write this post, J:K are displayed as I wish, G:H are not.
Also of note, my knowledge is < a newbie when it comes to VBAs, I think I got this code from a youtube clip. The code sometimes fails and causes an error that I am trying to recreate.
Any help is appreciated.