Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Permanent Variable?
I am sure this is a pretty stupid question, but.....
Is there any way to store a permanent variable that can be incremented over time between sessions and calls to the function? Meaning: I want to store a number in a variable that can be accessed / added to / and subtracted from from different functions over the course of many workbook openings and closings. For example: perVar would refer to a number like 1. When function IncPerm() was run, it would add 1 to perVar so that perVar = 2 for all other functions to reference from then on. I know that I can store this value in a cell, but I am trying to avoid that. Any one have any ideas on this? All help is greatly appreciated. Many thanks, Random |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Permanent Variable?
How would I reference that in VBA? I tried using the macro recorder,
but can't decipher what the verbage is for adding to and subtracting. I have tried: ActiveWorkbook.Names("Bob").Value = _ Right(ActiveWorkbook.Names("Bob").Value, Len(ActiveWorkbook.Names("Bob").Value)-1) + 1 But that errors out.... I can't seem to find this in the help file either... any suggestions? Random. On Thu, 14 Aug 2003 20:11:31 -0500, "Chip Pearson" wrote: Random, You might consider storing the value in a defined name. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Permanent Variable?
Create the name ThisName, and give it some initial value. Then use
the following to increment the value: ThisWorkbook.Names.Add "TheName", _ Val(Mid(ThisWorkbook.Names("TheName").RefersTo, 2)) + 1 -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Random" <Random@nwhere wrote in message ... How would I reference that in VBA? I tried using the macro recorder, but can't decipher what the verbage is for adding to and subtracting. I have tried: ActiveWorkbook.Names("Bob").Value = _ Right(ActiveWorkbook.Names("Bob").Value, Len(ActiveWorkbook.Names("Bob").Value)-1) + 1 But that errors out.... I can't seem to find this in the help file either... any suggestions? Random. On Thu, 14 Aug 2003 20:11:31 -0500, "Chip Pearson" wrote: Random, You might consider storing the value in a defined name. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date is not permanent | New Users to Excel | |||
how do you get a permanent cache? | Excel Discussion (Misc queries) | |||
Making Values Permanent | Excel Discussion (Misc queries) | |||
Permanent Reference | Excel Discussion (Misc queries) | |||
Permanent formula? | Excel Worksheet Functions |