Darren Smith
Well-known Member
- Joined
- Nov 23, 2020
- Messages
- 631
- Office Version
- 2019
- Platform
- Windows
This code works fine except the worksheets end up a different order in the Destination.
Any way of stopping this?
Any way of stopping this?
VBA Code:
Private Sub Jobcard_Templates_Click()
TurnOff
Dim wkbDest As Workbook
Dim wkbSource As Workbook
Dim ws As Worksheet
Dim wsDest As Worksheet
Dim wsJobCardAnalysis As Worksheet
Dim CurrentSheet As Worksheet
Dim sht As Worksheet
Dim wsCount As Long
Set wkbDest = Workbooks("Automated Cardworker.xlsm")
Set wsDest = Worksheets("Job Card with Time Analysis")
Set ws = ThisWorkbook.Worksheets("Job Card Master")
Set wsJobCardAnalysis = ThisWorkbook.Worksheets("Job Card with Time Analysis")
ws.Delete
wsJobCardAnalysis.Delete
Set wkbSource = Workbooks.Open("\\tgs-srv01\share\ShopFloor\PRODUCTION\DLS Cardworker\Jobcard Templates\" _
& Body_And_Vehicle_Type_Form.Jobcard_Templates.List(Body_And_Vehicle_Type_Form.Jobcard_Templates.ListIndex))
For Each sht In Workbooks(wkbSource.Name).Sheets
sht.Copy After:=Workbooks(wkbDest.Name).Sheets(5)
Next sht
wkbSource.Close savechanges:=False
ThisWorkbook.Worksheets("Job Card Master").Activate
TurnOn
End Sub