• 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 paste from last empty cell

Pierre

Member
Hello,

I have this piece of code which allows me to select an Excel file, copy a range of data and paste it from cell A10.

I would like to modify it in order to paste data to last empty cell of column A

Code:
Sub Get_Data_From_File()
    Dim FileToOpen As Variant
    Dim OpenBook As Workbook

    Application.ScreenUpdating = False
    FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
   
    If FileToOpen <> False Then
        Set OpenBook = Application.Workbooks.Open(FileToOpen)
        OpenBook.Sheets(1).Range("A1:E20").Copy
        ThisWorkbook.Worksheets("SelectFile").Range("A10").PasteSpecial xlPasteValues
        OpenBook.Close False
       
   
    End If
   
    Application.ScreenUpdating = True

End Sub
Can someone advise how to modify?

Thank you!
 
Last edited:

Fluff13

Active Member
How about
Code:
ThisWorkbook.Worksheets("SelectFile").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
 
Top