View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nicolas Roth Nicolas Roth is offline
external usenet poster
 
Posts: 5
Default global variables

thanks for your answer, but actually what i would like to dois to
define all the variables i will use in the others modules. so there
will be more than one, and there will also be worksheets and workbooks.
John Fuller wrote:
You could do something like this:

Function Get_Size()
Get_Size = Cells(1,1)
End Function

Sub Test2()
Cells(2,1) = Get_Size() * 2
End Sub

Though I'm not sure exactly what you're looking for so not sure if
that's going to be any help.


Nicolas Roth wrote:
Hello, i have been searching the threads to get some info, but nothing
answered 100% my question. Is there another way to have access to the
variable size than using the call in the following code:


Option Explicit
Public size As Integer

Public Sub test1()
size = Cells(1, 1)
End Sub

Public Sub test2()
Call test1
Cells(2, 1) = size * 2
End Sub

thanks, Nicolas