Use column number in a range instead of column letter

G

Greg Snidow

Greetings. How can I use a column number in a range, instead of column
letters? For example, I have Range("B3:B7").Select. I want to copy and
paste this range in another place in the worksheet, then run some other code,
and then copy Range("C3:C7") and run some code, all the way up to
Range("M3:M7"). I would like to be able to use a variable for the column
index, then just increment it by 1 at the end of the loop. Any ideas? Thank
you.
 
R

Rick Rothstein

You could work with offsets from the original range instead of specifying
column numbers...

For X = 0 To 11
Range("B3:B7").Offset(0, X).Select
' Do something with the selection
Next
 

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