Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default Where 2 place the code? (Worksheet Codes Vs. Modules)

Some times some of the macro and code pieces are advised to be placed at the
worksheet code level and sometimes a separate module operates well. What is
the difference between both and how to identify the same?
--

Best Regards,
FARAZ A. QURESHI
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Where 2 place the code? (Worksheet Codes Vs. Modules)


FARAZ QURESHI;241880 Wrote:
Some times some of the macro and code pieces are advised to be placed at
the
worksheet code level and sometimes a separate module operates well.
What is
the difference between both and how to identify the same?
--

Best Regards,
FARAZ A. QURESHI

It depends on how its written, but as a general rule if it
beginsPrivate Sub Worksheetthen its worksheet
code, if it beginsPrivate Sub Workbookit goes
in the Thisworbook module and lastly if it beginsSub
Macroit goes in a standard module and can be prefixed with
Public or Private.


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=67461

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Where 2 place the code? (Worksheet Codes Vs. Modules)

See
http://www.rondebruin.nl/code.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"FARAZ QURESHI" wrote in message ...
Some times some of the macro and code pieces are advised to be placed at the
worksheet code level and sometimes a separate module operates well. What is
the difference between both and how to identify the same?
--

Best Regards,
FARAZ A. QURESHI


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Where 2 place the code? (Worksheet Codes Vs. Modules)

Hi,

Generally speaking the Sheet and thisWorkbook modules are for event code
related to a specific sheet or thisWorkbook object. When you are in one of
these modules you will notice that you can choose Worksheet or Workbook from
the top left "object" drop down and then a "procedure" from the top right
dropdown. All code associate with these procedures are places in these
modules. In addition ActiveX control have their code here. The "procedures"
found in these modules only work if they are located here, although they can
call code in other modules.

Code can also be placed in Form objects and Class modules as well. Other
code is usually placed in the general modules, but that is not a requirement
in all cases.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"FARAZ QURESHI" wrote:

Some times some of the macro and code pieces are advised to be placed at the
worksheet code level and sometimes a separate module operates well. What is
the difference between both and how to identify the same?
--

Best Regards,
FARAZ A. QURESHI

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
Adding area codes only to phone numbers missing an area code RC Excel Discussion (Misc queries) 5 May 3rd 23 05:06 PM
Macro to import modules into a worksheet michaelberrier Excel Discussion (Misc queries) 1 June 4th 06 07:39 PM
Delete Code Modules Programatically blatham Excel Discussion (Misc queries) 1 February 3rd 06 05:38 PM
Wherre best to place code luke New Users to Excel 2 August 22nd 05 08:25 PM
Linking worksheet event codes Mr. G. Excel Worksheet Functions 7 July 15th 05 06:15 PM


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