Hello!
I have been trying to get the below code to run after I have entered a date in column B and exit the Cell. The code works perfectly if I go out of the cell in column B and then go back into it. After reentering B the code runs flawlessly. I have searched relentlessly for a solution with no resolve. if anybody has any Ideas I would be forever grateful.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("b2:b1048576")
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
Select Case ActiveCell(1, 1).Value
Case Is = ""
ActiveCell(1, 22).Value = ""
ActiveCell(1, 0).Value = ""
Case Is < Date
ActiveCell(1, 22).Value = Date
ActiveCell(1, 0).Value = Date
Case Is >= Date
ActiveCell(1, 22).Value = ActiveCell(1, 1).Value
ActiveCell(1, 0).Value = Date
End Select
End If
End Sub
I'm new to this forum so I hope I'm posting to the right area.
Thanks in advance for your help!
I have been trying to get the below code to run after I have entered a date in column B and exit the Cell. The code works perfectly if I go out of the cell in column B and then go back into it. After reentering B the code runs flawlessly. I have searched relentlessly for a solution with no resolve. if anybody has any Ideas I would be forever grateful.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("b2:b1048576")
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
Select Case ActiveCell(1, 1).Value
Case Is = ""
ActiveCell(1, 22).Value = ""
ActiveCell(1, 0).Value = ""
Case Is < Date
ActiveCell(1, 22).Value = Date
ActiveCell(1, 0).Value = Date
Case Is >= Date
ActiveCell(1, 22).Value = ActiveCell(1, 1).Value
ActiveCell(1, 0).Value = Date
End Select
End If
End Sub
I'm new to this forum so I hope I'm posting to the right area.
Thanks in advance for your help!