Hi All,
I am bit new to vba coding in excel. Prsently I am trying create an excel sheet which capture the date once the data has been entered in a cell and the date should change.some how manage to get below vba code to capture the date of one column.which works perfectly. Presently what I need is to capture date of another cell column too from same sheet.
Following is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyDatas As Range
Dim MyDataRngs As Range
Set MyDataRngs = Range("R3:R1000")
If Intersect(Target, MyDataRngs) Is Nothing Then Exit Sub
On Error Resume Next
If Target.Offset(0, -6) = "" Then
Target.Offset(0, -6) = Now
End If
'Target.Offset(0, 2) = Now
For Each MyDatas In MyDataRngs
If MyDatas = "" Then
MyDatas.Offset(0, -6).ClearContents
MyDatas.Offset(0, -6).ClearContents
End If
Next MyDatas
End Sub
I am bit new to vba coding in excel. Prsently I am trying create an excel sheet which capture the date once the data has been entered in a cell and the date should change.some how manage to get below vba code to capture the date of one column.which works perfectly. Presently what I need is to capture date of another cell column too from same sheet.
Following is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyDatas As Range
Dim MyDataRngs As Range
Set MyDataRngs = Range("R3:R1000")
If Intersect(Target, MyDataRngs) Is Nothing Then Exit Sub
On Error Resume Next
If Target.Offset(0, -6) = "" Then
Target.Offset(0, -6) = Now
End If
'Target.Offset(0, 2) = Now
For Each MyDatas In MyDataRngs
If MyDatas = "" Then
MyDatas.Offset(0, -6).ClearContents
MyDatas.Offset(0, -6).ClearContents
End If
Next MyDatas
End Sub