Hello, I am getting an error that I don't quite understand. Any thoughts on why I am getting this error?
Compile Error: Expected Function or Variable....
Compile Error: Expected Function or Variable....
Code:
Sub Copy_BOE_Template()
Dim sh As Worksheet
Dim i As Integer
Dim i2 As Integer
'STEP 5: Set sheet to copy
Set sh = Worksheets("Template - BOEs")
'STEP 6: Determine number of copies to make
i = Worksheets("Staffing Plan").Range("D5")
'STEP 7: Name the first sheet
sh.Name = "Template - BOEs"
i2 = ActiveWorkbook.Worksheets.Count
For X = 1 To i
sh.Copy After:=Sheets(i2 + X - 1)
'STEP 8: Name of subsequent sheets
Sheets(X + i2).Name = "Labor BOE " & X & " of " & i
Next X
End Sub