pick date & time from my system auto

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i want to do that as i enter any name in a cell and press enter its automaticly collect the date and time from system to next cell how can i do this plz help me !! thankx
 
You could do it with worksheet event code


Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
Target.Offset(0, 1).Value = Now

ws_exit:

Application.EnableEvents = True
End Sub


Put this in the worksheet code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

help me said:
i want to do that as i enter any name in a cell and press enter its
automaticly collect the date and time from system to next cell how can i
do this plz help me !! thankx
 
-----Original Message-----
i want to do that as i enter any name in a cell and
press enter its automaticly collect the date and time from
system to next cell how can i do this plz help me !!
thankx
Copy this into a VB module


Sub Auto_Open()
Application.OnEntry = "GetDate"

End Sub

Sub GetDate()
Sheets("sheet1").Select
If ActiveCell.Column = 1 And _
ActiveCell.Row > 3 _
And Not IsEmpty(ActiveCell) Then
ActiveCell.Offset(0, 1) = Now()
End If
End Sub

It places the date into column B provided that the row is
greater than 3. Change the sheet, row and column to suit.

You might like to change the format.

Regards
Peter
 
Right click the sheet tab and select View Code. Copy and paste th
following macro. You may need to change the column number (etc).

'-------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If ActiveCell.Column = 1 Then
ActiveCell.Offset(0, 1).Value = Format(Now, "dd/mm/yy")
End If
End Sub
'-------------------------------------------------------
 
Back
Top