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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top