refering to a range with a variable

E

eyecalibrate

I'm looking for a way to refer to a range with a variable. Let me
demonstrate.

Dim MyVar
MyVar = ActiveCell.Value
Range("A14").Select

I've tried this:

Dim MyVar
MyVar = ActiveCell.Value
Range("A(MyVar)").Select

But (of course) it doesn't work; however this is essentially what I
need.

How can I make this happen?
 
F

Frank Kabel

Hi
try
sub foo()
Dim rng as range
set rng = activecell
msgbox rng.value
end sub
 
T

Tom Ogilvy

Dim MyVar as String

Myvar = ActiveCell.Address
Range("A14").Select
Range(MyVar).Select

If you want to select a cell in column A where the specific row number is
specified in the activecell

myVar - ActiveCell.Value
Range("A" & myVar).Select

or

Cells(ActiveCell.Value, "A").Select
 

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