PDA

View Full Version : [SOLVED] ADDING A SHEET USING VBA BUT GETTING ERROR



ytjjjtyj
06-26-2019, 11:12 AM
Hello,
So I have option explicit on the top of my code and I am trying to add a worksheet into my workbook using VBA. However, I want my syntax to add the worksheet to the right side of the existing worksheets, not before them. How do I do that without getting a syntax error or "missing = expression" error?

I tried this and it did not work:
ActiveWorkbook.Sheets.Add(False, True)

Thanks in advance!

Bob Phillips
06-26-2019, 11:30 AM
With ActiveWorkbook

.Worksheets.Add After:=.Worksheets(.Worksheets.Count)
End With

ytjjjtyj
06-26-2019, 11:53 AM
thank you!