I had posted in a different location: https://www.pcreview.co.uk/forums/thread-2385874.php
This explanation may make it even clearer: What I am trying to do is have a cell on a Sheet display the time automatically, and remain static once it has been selected. Using VB I have gotten it to update when the cell was selected, but it doesn't remain static to the original time. This is the code I was using:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B22")) Is Nothing Then
Target.Value = Format(Now, "hh:mm:ss")
ElseIf Not Intersect(Target, Me.Range("F22")) Is Nothing Then
Target.Value = Format(Date, "m/d/yyyy")
End If
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B33")) Is Nothing Then
Target.Value = Format(Now, "hh:mm:ss")
ElseIf Not Intersect(Target, Me.Range("F33")) Is Nothing Then
Target.Value = Format(Date, "m/d/yyyy")
End If
ws_exit:
Application.EnableEvents = True
End Sub
I have also tried using Checkboxes (not in VB) with IF statements, but after
it has been "unselected" the value still remains. This is the statement that I was using:
=IF(Q9=TRUE,NOW(),Null)
Honestly, at this point I haven't the foggiest on where to go.
This explanation may make it even clearer: What I am trying to do is have a cell on a Sheet display the time automatically, and remain static once it has been selected. Using VB I have gotten it to update when the cell was selected, but it doesn't remain static to the original time. This is the code I was using:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B22")) Is Nothing Then
Target.Value = Format(Now, "hh:mm:ss")
ElseIf Not Intersect(Target, Me.Range("F22")) Is Nothing Then
Target.Value = Format(Date, "m/d/yyyy")
End If
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B33")) Is Nothing Then
Target.Value = Format(Now, "hh:mm:ss")
ElseIf Not Intersect(Target, Me.Range("F33")) Is Nothing Then
Target.Value = Format(Date, "m/d/yyyy")
End If
ws_exit:
Application.EnableEvents = True
End Sub
I have also tried using Checkboxes (not in VB) with IF statements, but after
it has been "unselected" the value still remains. This is the statement that I was using:
=IF(Q9=TRUE,NOW(),Null)
Honestly, at this point I haven't the foggiest on where to go.