Excel equivalent to Word Variable

F

Fred Kruger

Can anyone tell me if excel has an in built variable for
each workbook simular to the words
Activedocument.Variables("")

If so what is it please i cannot seem to find and
referance to such a variable.

If not does anyone know of a way of storing information
in a variable that is specific only to that workbook.

Thanks in anticipation.

Fred
 
F

Frank Kabel

Hi
one way would be to use the property
CustomDocumentProperties
of your workbook (see the VBA help for this topic)

You may also consider defining a name (menu: 'Insert -
Name - Define') and use this to store your variables
 
F

Fred Kruger

Thanks chaps for your help

Fred
-----Original Message-----
You can use 2 ways:

activeworkbook.Names.Add "ajay","100"
?activeworkbook.names("ajay").Value
=100
Note that the values of variables are always strings and have a perfix =.

The other way

activeworkbook.Worksheets(1).Cells(1,1).Id ="100"
?activeworkbook.Worksheets(1).Cells(1,1).Id
100
?10*activeworkbook.Worksheets(1).Cells(1,1).Id
1000

This retains the type of the value but does have the
overhead of remembering where the value is held (there is
no variable name!).
 
Top