Hi Sanu,
Ok, edited code below, should be ok now...
Open VBA editor, double-click on the name of the sheet you want to use the macro on, and then paste the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDataRange As Range
Dim rownum As Long
Set rngDataRange = Range("H1:H1000") 'Enter range(s) that should be monitored
Application.ScreenUpdating = False
If Not Intersect(Target, rngDataRange) Is Nothing Then
Application.EnableEvents = False 'Prevent following code from triggering events
'Code to do what is desired when range is activated goes below
rownum = Target.Row
If Target.Value = "" Then
Cells(rownum, 4).Value = ""
Cells(rownum, 5).Value = ""
End If
If Target.Value <> "" Then
If Cells(rownum, 4).Value = "" Then Cells(rownum, 4).Value = Date
If Cells(rownum, 5).Value = "" Then Cells(rownum, 5).Value = Time
End If
End If
Set rngDataRange = Nothing
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Bookmarks