Excel equivalent to Word Variable

  • Thread starter Thread starter Fred Kruger
  • Start date Start date
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
 
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
 
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!).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top