Hello! I am working on creating an excel workbook (tool) for my sales support team that would allow users to open the file explorer, select a file, copy data and then paste it into the original workbook (tool). However, when I try to go to my original workbook (Delphi Event Fee Report) to paste the data I have copied, I get a run time error 424 object required message. I have tried to define the original workbook various ways but always get the object error message. Any thoughts? The Delphi Event Fee Report Temp file is the tool I am creating; the import button tab has a command button I am trying to assign the macro to. The Event Fee Modified file is the file I am copying the data from. The Delphi Data tab on the Delphi Event Fee Report Temp file is where I want the data pasted (cell A2, paste special values). Thank you!
Code:
>>> https://chandoo.org/forum/threads/posting-a-sample-workbook.451/ - how to use tags... <<<
Code:
Code:
Sub Import()
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for Event Fee Report", FileFilter:="Excel Files(*.xls*),**xls*")
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
ActiveSheet.Range("A2:p500").Select.Copy
Workbooks("Delphi Event Fee Report Template 2.xlsm").Activate
Range("A2").Select
ActiveSheet.PasteSpecial xlPasteValues
OpenworBook.Close False
End If
Application.ScreenUpdating = True
End Sub
Attachments
Last edited by a moderator: