get a sheet of a Excel file

  • Thread starter Thread starter Deer Hunter
  • Start date Start date
D

Deer Hunter

Hi!

Has somebody an example how I get an overview of all sheets of an external
excel file, select one sheet and import this sheet into the open current
worksheet?
All suggestions are welcome!

Regards,

Mike
 
Start from here

Sub ImportSheet()
Dim Wkb As Workbook
Dim Wkt As Worksheet
Dim MsgStr As String
For Each Wkb In Application.Workbooks
If Wkb.Name <> ThisWorkbook.Name Then
For Each Wkt In Wkb.Worksheets
MsgStr = "Import " & Wkt.Name & " from " & Wkb.Name & "? "
If MsgBox(MsgStr, vbYesNo) = vbYes Then
Wkt.Copy Before:=ThisWorkbook.Sheets(1)
End If
Next
End If
Next
End Sub
 
Back
Top