PDA

View Full Version : Show date and time



Ryu
11-10-2008, 04:02 AM
Hi people,

Just a really simple question, I have three worksheets in Excel Sheet1, Sheet2and Sheet3, all of them have different columns however column A is the same (column A is called Date/Time.) I have created a button on Sheet 4 and was wondering would it be possible to run some coding where when the button is clicked on sheet 4 then the current date and time is shown in Column A on all of the sheets from 1 to 3 on a new row?
The format I would prefer would be something like 10/11/2008 13:05

Thanks

GTO
11-10-2008, 04:23 AM
Greetings Ryu,

You could have the below run from the button.

Hope this helps,

Mark

Sub DateStamp()
Dim _
wks As Worksheet, _
dtmStamp As Date

dtmStamp = Format(Now(), "mm/dd/yyyy hh:mm")

For Each wks In ThisWorkbook.Worksheets

If Not wks.Name = "Sheet4" _
Then wks.Range("A65536").End(xlUp).Offset(1).Value = dtmStamp
Next

End Sub