Hi,
With much help from various sources I've put a Macro together that pastes excel data from an external (user selected) excel file into the "Active" workbook. The workbook has 2 tabs "DailyOrders" and "TEMPLATE". So far when I run the macro the data is pasted into the "DailyOrders" tab and that is it. I would like the macro to finish by having the user looking at the "TEMPLATE" tab. The Macro code so far is:
Sub ImportData()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim Sheet As Worksheet
Dim PasteStart As Range
Set wb1 = ActiveWorkbook
Set PasteStart = [DailyOrders!A3]
Sheets("DailyOrders").Select
Cells.Select
Selection.ClearContents
FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a Report to Parse", _
FileFilter:="Report Files *.xls (*.xls),")
If FileToOpen = False Then
MsgBox "No File Specified.", vbExclamation, "ERROR"
Exit Sub
Else
Set wb2 = Workbooks.Open(Filename:=FileToOpen)
For Each Sheet In wb2.Sheets
With Sheet.UsedRange
.Copy PasteStart
Set PasteStart = PasteStart.Offset(.Rows.Count)
End With
Next Sheet
End If
wb2.Close
End Sub
Would someone be able to help me to add some further code that ends by selecting the "Template" tab of my workbook? If so where in the code routine should the command sit?
Bookmarks