![]() |
macro run automatically
How can a macro can run automatically when a work book open
or hitting refresh data? Thnks Daniel |
macro run automatically
Put the code (or a call to the routine) in the
Workbook_OPEN() event processor to get it to run when the workbook is open. To get to that place, right-click the Excel icon to the left of the File entry in the menu bar and choose [View Code] from the list. When the VB Editor opens there'll be 2 drop-down lists available at the top. Use the one one the left and choose WORKBOOK from its list. The default procedure created will be Private Sub Workbook_Open() End Sub You can either put the code to be run within that section (between Private... and End Sub). Or just a call to the name of a routine located elsewhere. Not certain about data refresh - try doing the same thing with Worksheet_Change() event (right-click worksheet's name tab and choose View Code from its list). In this case the default is Worksheet_SelectionChange() which you don't want, so choose plain Change from the right-hand dropdown for that code module. I'm just not positive right this minute that the Change event triggers on a data refresh. "Daniel" wrote: How can a macro can run automatically when a work book open or hitting refresh data? Thnks Daniel |
All times are GMT +1. The time now is 02:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com