Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What's the best????

is there a difference between writing VBA code in...
1) This Workbook
2) Sheet
3) Module

Does any affect excel performance????

-Larry-
VBA Amateur


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default What's the best????

Larry,

While there is no performance impact of the location of the code,
where you put it is important. In general, you should put all
your macros and functions in standard code modules. The only
thing that should be in the ThisWorkbook and the Sheet modules
are the event procedures for those objects.


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


"nrage21 " wrote in
message ...
is there a difference between writing VBA code in...
1) This Workbook
2) Sheet
3) Module

Does any affect excel performance????

-Larry-
VBA Amateur


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What's the best????

Thanks for the tip Chip!

:

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default What's the best????

All different and have different uses:-

1) ThisWorkbook - Often used for things such as macros that will execute
automatically when you open the file. They typically have to go in here.

2) Sheet - Often used for Event macros, eg on sheet 1, anytime someone types
something and you want it converted to CAPS/Lowercase, numbers validated etc, or
clicks somewhere on that sheet and you want something to happen.

3) Module - Where 95% of the macros you use will likely go. These macros are
available to you via the Tools / Macro / Macros option when in any worksheet.

For a far better description of all these and mo-

http://cpearson.com/excel/codemods.htm

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"nrage21 " wrote in message
...
is there a difference between writing VBA code in...
1) This Workbook
2) Sheet
3) Module

Does any affect excel performance????

-Larry-
VBA Amateur


---
Message posted from http://www.ExcelForum.com/



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004


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



All times are GMT +1. The time now is 03:20 PM.

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

About Us

"It's about Microsoft Excel"