ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy cells to end of range in other column (https://www.excelbanter.com/excel-programming/395587-copy-cells-end-range-other-column.html)

Eric_G

copy cells to end of range in other column
 
I believe this question has been answered previously, but I can't easily
locate the answer.

I wish to copy cell value "Y2" to cells Y3 downward to the last row where a
value exists in column X.

Any suggestions?

Ron de Bruin

copy cells to end of range in other column
 
Try this one for "Sheet1"

Sub test()
With Worksheets("Sheet1")
Set SourceRange = .Range("Y2")
Set fillRange = .Range("Y2:Y" & .Cells(Rows.Count, "X").End(xlUp).Row)
End With
SourceRange.AutoFill Destination:=fillRange
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Eric_G" wrote in message ...
I believe this question has been answered previously, but I can't easily
locate the answer.

I wish to copy cell value "Y2" to cells Y3 downward to the last row where a
value exists in column X.

Any suggestions?


joel

copy cells to end of range in other column
 

Sub copydown()

LastRowX = Cells(Rows.Count, "X").End(xlUp).Row
Set pasterange = Range(Cells(3, "Y"), Cells(LastRowX, "Y"))

Range("Y2").Copy Destination:=pasterange

End Sub

"Eric_G" wrote:

I believe this question has been answered previously, but I can't easily
locate the answer.

I wish to copy cell value "Y2" to cells Y3 downward to the last row where a
value exists in column X.

Any suggestions?


Eric_G

copy cells to end of range in other column
 
Than you both -- worked fine.

"Joel" wrote:


Sub copydown()

LastRowX = Cells(Rows.Count, "X").End(xlUp).Row
Set pasterange = Range(Cells(3, "Y"), Cells(LastRowX, "Y"))

Range("Y2").Copy Destination:=pasterange

End Sub

"Eric_G" wrote:

I believe this question has been answered previously, but I can't easily
locate the answer.

I wish to copy cell value "Y2" to cells Y3 downward to the last row where a
value exists in column X.

Any suggestions?



All times are GMT +1. The time now is 11:02 AM.

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