What I have is a separate Private Sub that gets a value and sets it as variable "Record" with type Double.
Now I need to be able to reference that value even though it is in another sub?
For example:
Private Sub GetValue()
Dim Record as Double
Record = (Code to find Record)
End Sub
How do I reference that "Record" in another Sub?
Thanks in advance, Bob P
I'm more a SQL Server and Excel guy, buy if I had to solve your problem, I'd do it in one of two ways. That can't really be the body of your function, is it - because the Record is set as local, and then.... disappears!
Dim Record as Double
outside of any sub. This also means that it get set whenever you last call this Sub, assuming all other code only read from it. Function
instead. Example below Private Function GetRecord() as Double
Dim Record as Double
Record = ....
GetRecord = Record
End Function
Answer is you cant. Its private to that sub
What you need to do is either, have the
Dim Record as Double
in the general code, or, turn it into a function and return it so you can do
Myrecord = GetValue()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.