PDA

View Full Version : copy cell without range



inajica
03-07-2010, 10:20 AM
I am trying to copy different cells ranges. I don't want to use the currentregion since I have adjacent cells that I don't want to copy. Is there a code that I can use without specifying a range, excecpt for the starting cell. For example, all data in column A starting at a4. Thank you.

lucas
03-07-2010, 11:03 AM
Maybe:
Option Explicit
Sub a()
Dim FinalRow As Long
'the -3 is to deal with the 3 spaces above A4
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row - 3
Range("A4").Resize(FinalRow, 1).Copy
Range("C4").PasteSpecial
End Sub

inajica
03-08-2010, 03:42 PM
Maybe:
Option Explicit
Sub a()
Dim FinalRow As Long
'the -3 is to deal with the 3 spaces above A4
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row - 3
Range("A4").Resize(FinalRow, 1).Copy
Range("C4").PasteSpecial
End Sub

Thanks for the code, it works great.