• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA copy last row of non blank to another sheet

pao13

Member
Hi. I'm attaching my workbook. What I would like is if it's possible a VBA or function that copies the last row of a sheet (eg. P_L events up to 2 months) and pastes it to Sheet1. By last row I mean the last row that column A is not blank.

Thanks for any help!
 

Attachments

  • RSX DATA28.xlsm
    350.9 KB · Views: 3
Last edited:

Hi, try this code pasting active worksheet last row data to Sheet1 :​
Code:
Sub Demo()
   Dim Rg As Range
   Set Rg = ActiveSheet.Columns(1).Find("*", , xlValues, , , xlPrevious)
If Not Rg Is Nothing Then
   Application.ScreenUpdating = False
       Rg.Resize(, Rg.CurrentRegion.Columns.Count).Copy
   Set Rg = Range("Sheet1!A" & Rows.Count).End(xlUp)(2)
       Rg.PasteSpecial xlPasteValuesAndNumberFormats
   Application.CutCopyMode = False
       Rg.Parent.Activate
       Rg(2).Select
   Set Rg = Nothing
End If
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Last edited:
Back
Top