Range in a Macro


Posted by Marianne on November 22, 2000 1:03 PM

Hello,

I have created a macro that will copy data from a row
in one worksheet to and add it to another row in another
worksheet. The problem that I am having is that the
macro always wants to copy the same row number when I
want it to copy from the row that I select.

For instance, my macro will copy row 10 of one worksheet
to another row in another worksheet. It then automatically
deletes row 10. Then, let say, I want to use the same
macro for line 20. Instead of copying line 20, it will
copy the data in line 10 again.

What is the command that I use to let me select the row?
Also, to make things a little more complicated, I don't
copy the entire row in one command, I do it in parts. How
can I set the ranges for those parts to be for the initial
row that I specify?

Thanks,

Marianne



Posted by Ivan Moala on November 25, 2000 6:03 AM

Marianne
something like this may help;

Rw = 10
Range(Cells(Rw, 1), Cells(Rw, 5)).Copy Destination:=Sheets(2).Cells(1, 1)

OR

Range("A" & Rw & ":E" & Rw).Copy Destination:=Sheets(2).Range("A2")

Just change Rw to the row you want.
You'll probably need a loop to loop through
he ranges and change ?


Ivan