Copy and rename multiple sheets
I have this code that copies the active worksheet 2x. The original worksheet name is L-2019. I have userform combo box (cboYear ) populated by the year. I would like to rename the 2 new sheets as L-#### and V-#### respectively (#### = cboYear). How can I accomplish this?
Code:
Dim wks as worksheet
For x = 1 To 2 ActiveSheet.Copy After:=Sheets("Security")
Next
wks.name = cboYear
here is my failed attempt...
Code:
For x = 1 To 2
ActiveSheet.Copy After:=Sheets("Security")
If Right(ActiveSheet.name, 3) = "(2)" Then ActiveSheet.name = "L-" & cboYear
If Right(ActiveSheet.name, 3) = "(3)" Then ActiveSheet.name = "V-" & cboYear
Next
Thank you kindly