Link to home
Start Free TrialLog in
Avatar of dabug80
dabug80

asked on

Excel: Paste value to next blank row after X

Hello,

Seeking your help on the following -

I would like to copy a cell and paste it to another sheet - to the first blank row in column A (after row A8).

I currently have this code - can you please assist:

Sub mac_pastevalue
'
' mac_pastevalue


' Here I copy a cell and then choose another active sheet

    Sheets("PO Template").Select
    Range("R12").Select
    Selection.Copy
    Sheets("PO Request Summary").Select

'Here I want to paste the above into the first blank row in column A, after A8
  

End Sub

Open in new window

Avatar of Wilder1626
Wilder1626
Flag of Canada image

You can try this:

  Sheets("PO Template").Select
        Range("R12").Select
        Range(Selection, Selection.End(xlDown)).Copy Destination:=Sheets("PO Request Summary").Range("A8" & Rows.Count).End(xlUp).Offset(1)

Open in new window


or


  Sheets("PO Template").Range("R12").Select
        Range(Selection, Selection.End(xlDown)).Copy Destination:=Sheets("PO Request Summary").Range("A8" & Rows.Count).End(xlUp).Offset(1)

Open in new window

Avatar of dabug80
dabug80

ASKER

Thanks. I tried both. And I get the same error.

For the two line code I get:

Runtime error: 1004:

Application-defined or object-defined error

With the debug on line 2.
ASKER CERTIFIED SOLUTION
Avatar of Wilder1626
Wilder1626
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dabug80

ASKER

Small adjustment to the code to make the VBA add values from the bottom, not the top.