Hi Folks,
I have a vba code which is working fine in my one of the file. In this file, I have applied a rule that whenever in column A and column U data will be entered, current date and time will be captured in another two columns. However there are validation applied in that file from where data to be selected.
I have another file in which data will be filled into column S to V and in column X I have inserted Countif formula that if any one cell from S to V is filled, it will return with Yes else cell in X column will be blank. Now I want is whenever the value in x column turns into "Yes" from blank, date and time should be captured in column "AA"
Kindly help me with required changes into my current code. I have tried myself but I failed to do it.
My current code :
I have a vba code which is working fine in my one of the file. In this file, I have applied a rule that whenever in column A and column U data will be entered, current date and time will be captured in another two columns. However there are validation applied in that file from where data to be selected.
I have another file in which data will be filled into column S to V and in column X I have inserted Countif formula that if any one cell from S to V is filled, it will return with Yes else cell in X column will be blank. Now I want is whenever the value in x column turns into "Yes" from blank, date and time should be captured in column "AA"
Kindly help me with required changes into my current code. I have tried myself but I failed to do it.
My current code :
Code:
Private Sub Worksheet_Change(ByVal Target as Range)
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.Activesheet.Range("X:X"), Target)
xOffsetColumn = 2
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng in WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, xOffsetColumn).Value = Now
Else
Rng.Offset(0, xOffsetColumn).ClearContents
Next
Application.EnableEvents = True
End If
End Sub