Consulting

Results 1 to 3 of 3

Thread: copy cell without range

  1. #1
    VBAX Regular
    Joined
    Dec 2007
    Posts
    26
    Location

    copy cell without range

    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.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Maybe:
    [VBA]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[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Regular
    Joined
    Dec 2007
    Posts
    26
    Location
    Quote Originally Posted by lucas
    Maybe:
    [vba]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[/vba]
    Thanks for the code, it works great.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •