Macro to copy a range

J

jamesa

I want to copy a range on a ws from A2 to H.. where the
text entry in colum H ends. Please help.

Regards
JA
 
Z

zantor

Hi jamesa,

Try this

Sub CopyMyRange()

Dim r As Integer
r = 2
Do While Cells(r, 7) <> ""
r = r + 1
Loop
Range(Cells(2, 1), Cells(r - 1, 7)).Copy

End Sub
 
T

Tom Ogilvy

Here is one possible interpretation of what you are asking:

Dim rng as Range
set rng = cells(rows.count,"H").end(xlup)
Range(Range("A2"),rng).copy destination:=Range("M2")
 

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