ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What's the best???? (https://www.excelbanter.com/excel-programming/289643-whats-best.html)

nrage21[_18_]

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/


Chip Pearson

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/




nrage21[_19_]

What's the best????
 
Thanks for the tip Chip!

:

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


Ken Wright

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




All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com