Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default This Workbook or Worksheets for VBA

Hi all,
I am learning some VBA to make more of Excel. In one book I am told to add
all the macros to 'This Workbook' whilst another book has me creating code
in separate worksheets as well as 'This Workbook'

Is there a proper way to do this as I would like to follow the correct path
to having the code run properly.

Thanks,
Mickey


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default This Workbook or Worksheets for VBA

Mickey,

Generally speaking, the ThisWorkbook module should contain only event
procedures for the workbook, and perhaps private procedures in support of
those event procedures. Similarly, the Sheet modules should contain only
event procedures for that particular sheet. If you don't know what an event
procedure is, then don't worry about it and don't put any code at all in
these modules. All other code should go in standard code modules, those you
insert from the Insert menu in VBA.




"Mickey" wrote in message
...
Hi all,
I am learning some VBA to make more of Excel. In one book I am told to

add
all the macros to 'This Workbook' whilst another book has me creating code
in separate worksheets as well as 'This Workbook'

Is there a proper way to do this as I would like to follow the correct

path
to having the code run properly.

Thanks,
Mickey




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default This Workbook or Worksheets for VBA

Hi Chip,
Thanks for the reply which makes sense and will be a great help.

Mickey


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
Sum for 26 worksheets on one workbook MO Excel Worksheet Functions 10 October 13th 09 04:14 PM
Combine worksheets in multiple workbook in one workbook with a macro Sam Commar Excel Discussion (Misc queries) 2 April 2nd 09 01:09 PM
Create New Workbook from Worksheets in One Workbook Dave Excel Discussion (Misc queries) 4 June 17th 07 10:27 PM
Add 6 worksheets in workbook Phil New Users to Excel 4 March 31st 06 03:29 AM
How do I build a workbook from the worksheets another workbook? Rico Excel Discussion (Misc queries) 4 August 19th 05 02:04 PM


All times are GMT +1. The time now is 02:30 AM.

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"