Changing a "Counter" Value from a Sub
If you create a public variable, and don't (very important) define the same
name in the subs, there is only one vraiable, and wherever that is changed
it will be picked up in the other module. For instance, try this
Public Count
Sub MySub()
Count = 1
msgbox "MySub: " & Count
Fred
msgbox "MySub: " & Count
End Sub
Sub Fred()
Count=Count+1
msgbox "Fred: " & Count
End Sub
You should see
MySub: 1
Fred: 2
MySub: 2
--
HTH
RP
(remove nothere from the email address if mailing direct)
"JimFor" wrote in message
...
Thanks. I'll try these. If I make a variable a Public variable and it
appears
in Fred, would MySub automatically use the value I assign it in Fred no
matter
what it would have been in MySub without what happens in Fred? Not sure
this
is happening with. me.
|