Dim Val01 as Variant
dim Val02 as Variant
Dim Val03 as Variant
dim Val04 as Variant
Dim Val05 as Variant
dim Val06 as Variant
with worksheets("whateverthenameishere")
val01 = .range("a1").value
val02 = .range("b99").value
val03 = .range("c23").value
val04 = .range("d13").value
val05 = .range("a11").value
val06 = .range("x9999").value
end with
=============
If you're setting this up and the users can insert/delete rows/columns, you may
want to use Insert|Name|Define to give each of those cells a nice name. Then if
they insert or delete rows or columns, the name will "move" with that cell--as
long as the user doesn't delete that cell.
with worksheets("whateverthenameishere")
val01 = .range("name01").value
val02 = .range("name02").value
val03 = .range("name03").value
val04 = .range("name04").value
val05 = .range("anothernamehere").value
val06 = .range("useanicenamehere").value
end with
I dimmed all the variables as variants, since I don't know if you have strings
or numbers in them.
Rookie_User said:
That works if you know or have the active cell what you want. But lets say
you have six variables and you know of six different cells that have
information you want. Can you assign the values of those into the different
variables..
maybe something like
x = cell[a1].value
y=cell[b1].value
or something?
Raman said:
You can create a variable in VBA and assign it the value of the cell
using the activeccell.value property
You can assign value when you track the cell with value
Your code could be
dim x 'declare a variable
x=activecell.value 'assing the variable the value of cell
For more,post your questions on
http://groups.google.co.in/group/answers-for-everything