The macro can obtain the values of the cells in the worksheet and assign them
to the variables in the macro.
In the example below, a equals to the value of cell A1 in sheet "Input". And
b equals to the value of cell A2. The macro then add up the two values and
display it in a messagebox.
Sub example()
Dim a
Dim b
With Worksheets("Input")
a = .Range("A1").Value
b = .Range("A2").Value
End With
MsgBox a + b
End Sub
Regards,
Edwin Tam
http://www.vonixx.com
"kishore" wrote:
Hi,
I am working on project, and wanted to define a list of variables which
should be called by the macro. Is it possible to define the all
variables in one sheet, say Input, and when macro execute it takes the
necessary values from this sheet. The idea is when we use this Excel
File for other project, I just need to change the variables on this
Input sheet...and the macros remain still valid. Till I used to change
these variables in the macro before running them. Any thoughts how to
do it and how to call these values in Macro.
Many thanks...any help highly appreciated!!!
Regards,
Kishore