How to specify a range using Row and Col Index instead of 'A1' notation?

K

keithb

How can I specify a range using Row and Col Index instead of 'A1' notation
in VBA?

Thanks,

Keith
 
D

Dave Peterson

dim myCell as range
dim myRow as long
dim myCol as long

myrow = 33
mycol = 15

set mycell = activesheet.cells(myrow,mycol)

or...

dim myrng as range
dim myRowS as long
dim myColS as long
dim myRowF as long
dim myColS as long

myrows = 33
mycols = 15
myrowf = 45
mycolf = 27

with activesheet
set myrng = .range(.cells(myrows,mycols),.cells(myrowf,mycolf))
end with

myRowS/F S=Start, f=Finish
 

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