SamarthSalunkhe
Board Regular
- Joined
- Jun 14, 2021
- Messages
- 103
- Office Version
- 2016
- Platform
- Windows
Hi All,
I am using the below code to import data from another sheet, but it is work's in a given range only.
But I want to import data from the available pivot table of sheets, can someone help me with this.
Thanks in Advance
I am using the below code to import data from another sheet, but it is work's in a given range only.
But I want to import data from the available pivot table of sheets, can someone help me with this.
VBA 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("A2:L50").Copy
ThisWorkbook.Worksheets("Import Data").Range("A2").PasteSpecial xlPasteValues
OpenBook.Close False
End If
Application.ScreenUpdating = True
End Sub
Thanks in Advance