View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Help With A Variable And Functions

'=================
Public myvalue
Public Sub MyMainFunction()
MsgBox myvalue
Call MySubThatChangesMyValue
MsgBox myvalue
End Sub
Sub MySubThatChangesMyValue()
myvalue = 35
'...some code that changes MyValue....
End Sub
'=============
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Andy" wrote in message
...
Hi Gang

I need some help with variables with functions. I've got a main
function that does some processing with a variable MyValue. I need to
create a sub function that changes the value of MyValue so that when
the sub function is done the main function knows what the new value of
MyValue is. How do I do this???

Please help,
Andy


Public Sub MyMainFunction()
MyValue = 10
Call MySubThatChangesMyValue

...more processing that relies on the changed MyValue...
End Sub

------------------------------------------------

Sub MySubThatChangesMyValue()
...some code that changes MyValue....
End Sub