View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default Using a macro in multiple sheets

I don't believe you can use same names but you may reference your macro to
Activesheet

"Dan" wrote:

Here's the latest thing making my head hurt:

I have a handful of macros which interact with a user to ultimately create a
block diagrm of sorts. The blocks have numbers associated with them, and all
around the blocks are calculations and results based on the exact connections
of the various types of blocks. This isn't a trivial macro (for me anyway).

Now, I would like to able to run my macros on another sheet in the same
workbook, without affecting the first sheet. But since I am using Names, I
seem to be stuck.
That is, I can't use the same Name on two different sheets. And I need to.
Is there a way to restrict reference to a Name to the sheet where it is
defined ONLY? In this project, one of the objectives is to end up with the
Names in the various equations (for ease of understanding the results). So I
don't want to resort to using "Sheet1:C24" type references.

I suppose I could "tag" each Name with a sheet reference, like "Vout_1". But
I'd like to avoid that if possible.

Thanks in advance -