Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this example in a new workbook:
Put the below VBA code into a general module: '------Start of Code------ Option Explicit 'Creates a hidden workbook-level name that can be used as a variable Sub CreateMyPermanentVariable() ThisWorkbook.Names.Add _ Name:="MyVariable", _ Visible:=False, _ RefersTo:="MySetting" End Sub 'Changes the RefersTo value of the hidden wkbk-level name Sub SetMyVariableValue() Names("MyVariable").RefersTo = "MyNewSetting" End Sub '------End of Code------ Then run the CreateMyPermanentVariable code Next, put this formula into any cell in a worksheet: =MyVariable (It will return "MySetting") Now run the SetMyVariableValue code The formula will now return "MyNewSetting" Experiment with settings. Does that help? *********** Regards, Ron XL2002, WinXP-Pro "filo666" wrote: Hi, good night (at last in Mexico), There is a way to set a variable value with a macro so that value exist all the time, I mean, all the time the program, it doesn´t metter if the macro ends or not?????????? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
A variable that save its value | Excel Programming | |||
Save Cellformat in a variable | Excel Discussion (Misc queries) | |||
Running a variable macro when any value is entered into a variable cell | Excel Programming | |||
Save Variable Values even after the macro has ended | Excel Programming | |||
Macro Creating Variable and using variable in a SQL statement | Excel Programming |