Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy a range with known start column to variable end column Matilda Excel Programming 2 August 2nd 06 04:55 PM
Copy column range of "single word" cells with spaces to a single c nastech Excel Discussion (Misc queries) 3 February 15th 06 05:04 PM
How to use macros to copy a range of cells which can exclude some cells which I didn't want to be copied? excelnovice Excel Worksheet Functions 2 September 25th 05 12:38 AM
Copy cells into range of cells until cell change mdeanda Excel Worksheet Functions 1 April 22nd 05 08:41 PM
Copy a formula to a range of cells via VB6 using .Range(Cells(row,col), Cells(row,col)).Formula= statement Kevin Excel Programming 7 October 5th 04 08:11 PM


All times are GMT +1. The time now is 07:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"