Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 354
Default macro run automatically

How can a macro can run automatically when a work book open
or hitting refresh data?
Thnks
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically Run macro Anift Setting up and Configuration of Excel 2 November 25th 06 02:52 PM
Automatically run a macro SheriTingle Excel Discussion (Misc queries) 2 July 12th 05 04:41 PM
Macro to automatically run Pam C Excel Discussion (Misc queries) 1 May 5th 05 02:35 PM
Run macro automatically. Excel macro New Users to Excel 7 April 19th 05 04:01 PM
Automatically run Macro tamato43 Excel Discussion (Misc queries) 0 March 30th 05 03:51 PM


All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"