I am in the process of putting together a tool that collects data from several excel files and pastes values into a summary sheet (the same file as contains vba).
For some reason I keep getting a "runtime error 13: mismatch" error for the last line of the code so far:
ThisWorkbook.Worksheets(ShSummary).Range("B5")
I'm guessing that maybe it doesn't like the "ThisWorkbook" reference, but I haven't had this issue before. Any ideas?
Sub Import_Data()
Dim FilePth As String
Dim SourceBook As Workbook
Dim LastCell_Nbr As Integer
'Open Follow Up file
FilePth = "C:\Users\xxx\Desktop\xxx\xxx\Follow-up_File.xlsm"
Set SourceBook = Application.Workbooks.Open(FilePth)
ActiveSheet.ShowAllData
LastCell_Nbr = Workbooks("Follow-up_File.xlsm").Sheets("Follow up").Cells(Rows.Count, "C").End(xlUp).Row
'Copy and paste data values into summary sheet
SourceBook.Sheets("Follow up").Range("A5:A" & LastCell_Nbr).Copy _
ThisWorkbook.Worksheets(ShSummary).Range("B5")
Thanks in advance!