SamarthSalunkhe
Board Regular
- Joined
- Jun 14, 2021
- Messages
- 103
- Office Version
- 2016
- Platform
- Windows
Hi All,
I am using the below code to copy the available date from another workbook, it is working fine but I want to copy data excluding the header line.
can someone help me to resolve this, I have tried my best but getting an error every time.
[/FONT]
I am using the below code to copy the available date from another workbook, it is working fine but I want to copy data excluding the header line.
can someone help me to resolve this, I have tried my best but getting an error every time.
VBA Code:
[FONT=Calibri]Sub IMPORT_DATA()
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for your File", FileFilter:="Excel Files (*.xls*),*xls*")
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
OpenBook.Sheets(1).Range("$A$2").CurrentRegion.Copy
ThisWorkbook.Worksheets("Input Sheet").Range("A8").PasteSpecial xlPasteValues
OpenBook.Close False
End If
Application.ScreenUpdating = True
End Sub