![]() |
Run a Macro on Startup for Specific Spreadsheet
Does any one know how I can setup a specific worksheet to run a macro only
when that specific worksheet is opened? Note: I do not want this macro to run for any other worksheet, just this specific one. Thanks |
Rod
I think you are looking for: Private Sub Worksheet_Activate() in the specific worksheet class (code) module. For "open" read "activate". Regards Trevor "Rod" wrote in message ... Does any one know how I can setup a specific worksheet to run a macro only when that specific worksheet is opened? Note: I do not want this macro to run for any other worksheet, just this specific one. Thanks |
Trevor, you Excel skills are greater than mine. Can you copy paste a
specific example assuming I had a macro named "autoexec"? Thanks, Rod "Trevor Shuttleworth" wrote: Rod I think you are looking for: Private Sub Worksheet_Activate() in the specific worksheet class (code) module. For "open" read "activate". Regards Trevor "Rod" wrote in message ... Does any one know how I can setup a specific worksheet to run a macro only when that specific worksheet is opened? Note: I do not want this macro to run for any other worksheet, just this specific one. Thanks |
right click the sheet tabview codeleft window select worksheetright
window select activateinsert your macro to runSAVE -- Don Guillett SalesAid Software "Rod" wrote in message ... Trevor, you Excel skills are greater than mine. Can you copy paste a specific example assuming I had a macro named "autoexec"? Thanks, Rod "Trevor Shuttleworth" wrote: Rod I think you are looking for: Private Sub Worksheet_Activate() in the specific worksheet class (code) module. For "open" read "activate". Regards Trevor "Rod" wrote in message ... Does any one know how I can setup a specific worksheet to run a macro only when that specific worksheet is opened? Note: I do not want this macro to run for any other worksheet, just this specific one. Thanks |
Rod
Private Sub Worksheet_Activate() autoexec End Sub Right-click on the sheet tab and "View Code". Copy/paste the above to that module. Note: autoexec must be available in the workbook, otherwise you have to point to it. Private Sub Worksheet_Activate() Application.Run ("mymacros.xla!autoexec") End Sub Gord Dibben Excel MVP On Wed, 16 Mar 2005 11:23:14 -0800, Rod wrote: Trevor, you Excel skills are greater than mine. Can you copy paste a specific example assuming I had a macro named "autoexec"? Thanks, Rod "Trevor Shuttleworth" wrote: Rod I think you are looking for: Private Sub Worksheet_Activate() in the specific worksheet class (code) module. For "open" read "activate". Regards Trevor "Rod" wrote in message ... Does any one know how I can setup a specific worksheet to run a macro only when that specific worksheet is opened? Note: I do not want this macro to run for any other worksheet, just this specific one. Thanks |
All times are GMT +1. The time now is 11:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com