Hello All,
I currently have macro that creates new WB in a designated drive.
I also have a combobox which decides which sheets to copy. So for example, if master is selected, it will copy sheeets 1,5,2 and if template1 is selected it will copy sheets 7,5,2. etc
THis is the current code i have but i am getting error on the Sheets(Array( portion of the code. Can someone help me out what I am doing wrong? i think the line with RED fonts are the problem as macro runs fine without that line and combobox3.
I currently have macro that creates new WB in a designated drive.
I also have a combobox which decides which sheets to copy. So for example, if master is selected, it will copy sheeets 1,5,2 and if template1 is selected it will copy sheets 7,5,2. etc
THis is the current code i have but i am getting error on the Sheets(Array( portion of the code. Can someone help me out what I am doing wrong? i think the line with RED fonts are the problem as macro runs fine without that line and combobox3.
Code:
Dim vFilename As Variant
Dim vPath As Variant
vpath1 = "[URL="file://\\tarcds01\eCTD_Submission\TRACKERS\"]\\tarcds01\eCTD_Submission\TRACKERS\[/URL]" & MyProduct & "\" & MyApplication & "\"
vpath2 = MyProduct & "-" & MyApplication & "-" & MySCN & "-" & MyEvent
[COLOR=#ff0000]If ComboBox3.Text = "Master" Then Sheets(Array("Sheet1", "Sheet5", "Sheet2")).Copy
[/COLOR][COLOR=#000000]ActiveWorkbook.SaveCopyAs Filename:=vpath1 & vpath2 & ".xlsm"
[/COLOR]If ComboBox3.Text = "Template1" Then Sheets(Array("Sheet7", "Sheet5", "Sheet2")).Copy
ActiveWorkbook.SaveCopyAs Filename:=vpath1 & vpath2 & ".xlsm"
'Reference the new workbook under a friendly name
Set newWBK = Workbooks.Open(vpath1 & vpath2 & ".xlsm")
'Make the new workbook active
newWBK.Activate