Re: date

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A:A")) Is Nothing Then
if ((target.row >=1 and target.row<=10) or _
(target.row >=20 and target.row<=30) or _
(target.row >=40 and target.row<=50) ) then
With Target
Offset(0, 1).Value = Format(Date, "dd mmm yyyy")
Offset(0, 2).Value = Format(Time, "h")
Offset(0, 3).Value = .Offset(0, 3).Value + 1 ' this is new line
End With
End If
End if
ws_exit:
Application.EnableEvents = True
End Sub


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=10470
View this thread: http://www.excelforum.com/showthread.php?threadid=380794

.


Quantcast