ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel equivalent to Word Variable (https://www.excelbanter.com/excel-programming/304236-excel-equivalent-word-variable.html)

Fred Kruger

Excel equivalent to Word Variable
 
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

Frank Kabel

Excel equivalent to Word Variable
 
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

-----Original Message-----
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
.


Fred Kruger

Excel equivalent to Word Variable
 
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!).



"Fred Kruger" wrote:

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

.



All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com