ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy a range (https://www.excelbanter.com/excel-programming/277517-macro-copy-range.html)

JamesA

Macro to copy a range
 
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

zantor[_10_]

Macro to copy a range
 
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



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Tom Ogilvy

Macro to copy a range
 
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")

--
Regards.
Tom Ogilvy
jamesa wrote in message
...
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





All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com