Hi
If you want Sheet4, then change
Worksheets("Sheet2") to Worksheets("Sheet4")
or, if you wanted it to apply to whichever sheet you were working on
then
Sub DateTime()
ActiveSheet.Range("H1").Value = _
Format(Now, "dd mmm yyyy hh:mm:ss")
End Sub
or if you wanted it to apply to whichever cell you were in on whichever
sheet, then
Sub DateTime()
ActiveCell.Value = _
Format(Now, "dd mmm yyyy hh:mm:ss")
End Sub
The reason for the file not found error, is that when you attached the
macro to the button, it saved it with the Filename at that time plus the
macro name.
If you right click on the button>Customise>right click on the
button>Assign macro>use dropdown on Macros in to select>This Workbook
and point to the Macro name DateTime.
Alternatively, you could copy the macro to a module in your Personal.xls
file, point the button to the macro in Personal .xls, then it would
always be available to you.
For more help on installing macros David McRitchie has a wealth of
information on his site at
http://www.mvps.org/dmcritchie/excel/install.htm
http://www.mvps.org/dmcritchie/excel/getstarted.htm