Excel Worksheets VBA Add Method
Your options with the Excel Worksheets VBA add method are all Optional and they are...
Before, After, Count, and Type. So...
Worksheets.Add , Worksheets(3), 2, xlWorksheet
would add 2 Worksheets After Sheet3. The first comma is a placeholder. You cannot use both the Before and After parameters in one statement. You're either adding a sheet(s) before a Worksheet or after the active Worksheet.
Worksheets.Add Worksheets(1) , , 2
would add 2 Worksheets Before Sheet1
The Type parameter can be xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. There is one catch though. If you use any type other than xlWorksheet, you would have to use the Sheets object rather than the Worksheets object.
Sheets.Add , , 2, xlChartwould add a chart Worksheet. This is the difference between Sheets and Worksheets objects.
This site is powered by Site Build It!. If you enjoy it, please check out the
Site Build It homepage to learn more and on how to build a success-guaranteed site with no technical skills.