Consulting

Results 1 to 5 of 5

Thread: VBA Code help- Paste to next empty cell in another worksheet

  1. #1
    VBAX Newbie
    Joined
    Jul 2011
    Posts
    2
    Location

    VBA Code help- Paste to next empty cell in another worksheet

    How do I get the following code to paste into the next available cell in Sheets("P.O. SHEET") (G10), if (G10) is empty. Then to the next cell beneath it (G11), if (G11) is empty then to cell beneath it, and so on...

    [VBA]Sub C_3()
    ' C_3 Macro
    Sheets("BMS").Select
    Range("C3").Select
    Selection.Copy
    Sheets("P.O. SHEET").Select
    Range("G10").Select
    ActiveSheet.Paste
    Sheets("BMS").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    End Sub
    [/VBA]
    any help at all will be very much appreciated, thank you

  2. #2
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    [VBA]
    Sub C_3()
    Sheets("BMS").Select
    Range("C3").Select
    Selection.Copy Destination:=ActiveWorkbook.Sheets("P.O. SHEET").Cells(Rows.Count, 7).End(xlUp).Offset(1, 0)
    End Sub
    [/VBA]
    ------------------------------------------------
    Happy Coding my friends

  3. #3
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    [VBA]
    Sub C_3()
    Sheets("BMS").Select
    Range("C3").Select
    If ActiveWorkbook.Sheets("P.O. SHEET").Range("G10").Value = Empty Then
    Selection.Copy Destination:=ActiveWorkbook.Sheets("P.O. SHEET").Range("G10")
    Else
    Selection.Copy Destination:=ActiveWorkbook.Sheets("P.O. SHEET").Cells(Rows.Count, 7).End(xlUp).Offset(1, 0)
    End If
    End Sub

    [/VBA]
    sorry i didnt see that G10 had to be the first option...the earlier version would just look for first empty cell in column 7 (G)
    ------------------------------------------------
    Happy Coding my friends

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]Sub C_3()
    WorkSheets("BMS").Range("C3").Copy _
    WorkSheets("P.O. SHEET").Range("G" & Rows.Count).End(xlUp).Offset(1, 0)
    End Sub[/VBA]

  5. #5
    VBAX Newbie
    Joined
    Jul 2011
    Posts
    2
    Location

    Thank you

    Thank you everyone for all your help. It definitely helpped me move on with my code.

    Thank you
    Sonny

Posting Permissions

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