copy cells to end of range in other column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
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
 
Than you both -- worked fine.

Joel said:
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
 

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

Back
Top