Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain Variant / String value
Dear all
I am new in vba and vb. I found that the store value of a variant or string will change back to zero after jump to other sub or private sub. How can I retain the store value even the program proceed to other sub or private sub? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain Variant / String value
abc,
You need to read up about "Scope" of variables. Also, understand how parameters to functions/subs work. NickHK "abc" wrote in message ... Dear all I am new in vba and vb. I found that the store value of a variant or string will change back to zero after jump to other sub or private sub. How can I retain the store value even the program proceed to other sub or private sub? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain Variant / String value
You can declare a static variable:
Static x as string "abc" wrote in message ... Dear all I am new in vba and vb. I found that the store value of a variant or string will change back to zero after jump to other sub or private sub. How can I retain the store value even the program proceed to other sub or private sub? Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain Variant / String value
thanks to all!
"Shatin" ¦b¶l¥ó ¤¤¼¶¼g... You can declare a static variable: Static x as string "abc" wrote in message ... Dear all I am new in vba and vb. I found that the store value of a variant or string will change back to zero after jump to other sub or private sub. How can I retain the store value even the program proceed to other sub or private sub? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
String to Variant incorrect conversion | Excel Worksheet Functions | |||
Variant as matrix | Excel Programming | |||
Variant Array | Excel Programming | |||
Variant Array with String Values - Type Mismatch | Excel Programming | |||
Variant to String | Excel Programming |