Use Variables for Cell Range

N

Nigel

I need to combine a constant cell column to a variable row...

i already have the variable set, but i don't know how to make a range
out of it....

for example...the 2 variables are VAR1 & VAR2

Range("AVAR1:FVAR2")

....obviously that doesn't work, but you get the idea of what im having
trouble accomplishing :)
 
N

NickHK

Nigel,
Depending how you variables are defined and what you are trying to achieve:

Range("A" & VAR1 & ":F" & VAR2)
or
Cells (VAR1,VAR2)
or
Range(Cells (VAR1,1),Cells (VAR2,6))

Also, depending on where you are calling this code, you may need to qualify
the Range/Cells objects e.g.

With ActiveSheet
.Range(.Cells (VAR1,1),.Cells (VAR2,6))
End With

NickHK
 

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

Top