Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Where Macros Are Located

I've noticed in VBE that there are a number of locations where macros may be
created and executed:

1. Each sheet can contain macros
2. There is something called ThisWorkbook
3. There can be a number of modules

Does it make any difference where I put my code?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default Where Macros Are Located

Absolutely, it does. You also left out Userforms, and class modules.
Most macros are written in modules.
Event-driven macros (like selecting a cell, or closing a workbook) are
written either in the sheet or workbook, depending on the event. Workbooks
have their specific set of events which are separate events from the
workbook (thisworkbook) events.
If you place your macros in a place they don't belong, they either won't
run, or will produce unexpected results.


"George B" wrote in message
...
I've noticed in VBE that there are a number of locations where macros may

be
created and executed:

1. Each sheet can contain macros
2. There is something called ThisWorkbook
3. There can be a number of modules

Does it make any difference where I put my code?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Where Macros Are Located

See Chip Pearson's discussion:
http://www.cpearson.com/excel/codemods.htm

Regards,
Greg

-----Original Message-----
I've noticed in VBE that there are a number of locations

where macros may be
created and executed:

1. Each sheet can contain macros
2. There is something called ThisWorkbook
3. There can be a number of modules

Does it make any difference where I put my code?


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Where Macros Are Located

Thanks -- that reference was a big help.

George Borrmann

"Greg Wilson" wrote in message
...
See Chip Pearson's discussion:
http://www.cpearson.com/excel/codemods.htm

Regards,
Greg

-----Original Message-----
I've noticed in VBE that there are a number of locations

where macros may be
created and executed:

1. Each sheet can contain macros
2. There is something called ThisWorkbook
3. There can be a number of modules

Does it make any difference where I put my code?


.



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
where exactly is solver located at? Durante Excel Discussion (Misc queries) 9 October 16th 07 04:26 AM
owners tab located? Bonnie Excel Discussion (Misc queries) 1 January 12th 06 01:33 AM
where is the excel template located? Doug McKean Excel Discussion (Misc queries) 3 September 28th 05 02:21 PM
How to print the column # where the max row value is located? Sam Excel Worksheet Functions 2 June 4th 05 08:15 PM
where can footnote be located? Josephine Excel Discussion (Misc queries) 1 December 20th 04 02:39 PM


All times are GMT +1. The time now is 11:43 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"