Thread: Global variable
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
dhstein dhstein is offline
external usenet poster
 
Posts: 266
Default Global variable

Thanks Dave.

"Dave Peterson" wrote:

Put the variable in a General/standard/normal module.

Public MyVar as Variant '????

Then in the ThisWorkbook module:

Option Explicit
sub workbook_open()
myvar = "what ever you want"
end sub



dhstein wrote:

I want to set a variable in a Workbook open event and then refer to it in
another module. I tried to set a Public variable in the Workbook code but
then the module doesn't recognize it. Any help is appreciated.


--

Dave Peterson
.