Macro that select different ranges

E

Emece

I have four columns with values. I need a Macro that selects the first seven
cells in column A, then the second seven cells in column A, and so on until
the last value in that column. After this I need the Macro to go to the other
columns and to the same.

Thanks in advance

Regards.
Emece.-
 
J

Joel

RowCount = 1
Do while Range("A" & RowCount) <> ""
Set MYData = Range("A" & RowCount & ":A" & (RowCount + 6))
RowCount = RowCount + 7
loop
 
E

Emece

Great, and what should I add if I want the selected range to be copy to
another range?

Thanks a lot
 
J

Joel

RI avoid using Select because it sometimes causes wrong items to be selected.
The macro record uses select but I always change select to a range or a
variable that is set to the range. The destination for a range only has to
specify the 1st cell of the area.


RowCount = 1
NewRow = 8
Do while Range("A" & RowCount) <> ""
Set MYData = Range("A" & RowCount & ":A" & (RowCount + 6))
MyData.Copy Destination:=Range("X" & Newrow)
RowCount = RowCount + 7
NewRow = NewRow + 7
loop
 

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