Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Public is not Public

Hi all,

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?

Clara
--
thank you so much for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Public is not Public



--
---
Regards,
Norman
Microsoft Excel MVP



"clara" wrote in message
...
Hi all,

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?

Clara
--
thank you so much for your help



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Public is not Public

Hi Clara

A public procedure should be placed in a standard module,
not a sheet module. Try, therefore, moving the code to a
standard module and your problem should be resolved.

In general, a sheet mpodule should only be used for sheet
event code,


---
Regards,
Norman


"clara" wrote in message
...
Hi all,

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?

Clara
--
thank you so much for your help



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Public is not Public

Hi Clara,

For additional information on the use of code modules,
see Chip Pearson at:

Code Module And Code Names
http://www.cpearson.com/excel/codemods.htm


---
Regards,
Norman
Microsoft Excel MVP


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Public is not Public

Since sheet modules are a class module you need to qualify the sub name.
For instance, if your public sub in Sheet1 is "test", then in the Sheet2
code module, use

Call Sheet1.test

Note that you should use the sheet's code name as the qualifier.


In article ,
clara wrote:

Why a public sub (defined in a sheet module ) can not be called in code
behind another sheet ?

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
Public? Chip Pearson Excel Programming 0 January 17th 07 11:28 PM
Use of PUBLIC BillCPA Excel Programming 6 June 7th 06 01:41 PM
Dim vs. Public Jason Morin Excel Programming 7 January 27th 05 01:13 PM
public sub Bob Excel Programming 3 December 10th 04 08:49 PM
Public Sub Help No Name Excel Programming 2 May 18th 04 11:09 PM


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