Sweet Hans, thanks.
Would you happen to know of some code I could assign to a command button to do the following:
Open browse window
Import all sheets within the selected workbook in to the active workbook?
Google is giving me nothing, not sure if it's even possible.
Import all sheets from another workbook
-
- 3StarLounger
- Posts: 206
- Joined: 31 Dec 2010, 22:23
- Location: Columbia Falls, MT
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Import all sheets from another workbook
I have moved this question to a thread of its own since it is not related to the subject of ListBox Issue.
Try this:
Try this:
Code: Select all
Sub ImportSheets()
Dim wbkSrc As Workbook
Dim wbkTrg As Workbook
Dim strFileName As String
strFileName = Application.GetOpenFilename
If strFileName = "False" Then
MsgBox "Action canceled", vbInformation
Exit Sub
End If
On Error GoTo ErrHandler
Application.ScreenUpdating = False
' ***** Optional settings *******************
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
' ***** End of optional settings ************
Set wbkTrg = ActiveWorkbook
Set wbkSrc = Workbooks.Open(Filename:=strFileName, ReadOnly:=True)
wbkSrc.Worksheets.Copy After:=wbkTrg.Worksheets(wbkTrg.Worksheets.Count)
wbkSrc.Close SaveChanges:=False
ExitHandler:
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
MsgBox Err.Description, vbExclamation
Resume ExitHandler
End Sub
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 206
- Joined: 31 Dec 2010, 22:23
- Location: Columbia Falls, MT
Re: Import all sheets from another workbook
Yes, I do think we (well I) was a bit off track there.
Anyway. This works amazing!!!!!!!!!!!!!
Anyway. This works amazing!!!!!!!!!!!!!