ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros (https://www.excelbanter.com/excel-programming/293162-re-macros.html)

Chip Pearson

Macros
 
Erik,

Take the code out of the Workbook_Open event and put it in a
regular macro in a regular code module:

Sub TimeStamp()
Worksheets("SLP Schedule").Range("P2").Value = Now
End Sub

Then, right click the tool bar button to which you want to assign
the macro, choose "Assign Macro" and select TimeStamp from the
list.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Erik" wrote in message
...
I have a sub in the thisworkbook code that places a date/time

stamp in a cell when the workbook is opened. How can I make this
a macro and assign it a button in the toolbar instead of it
running on open?

Private Sub Workbook_Open()
Worksheets("SLP Schedule").Range("P2").Value = Now
End Sub





All times are GMT +1. The time now is 01:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com