The VBA code to add a new sheet is
Code:
Sub CustomAddSheet()
'ActiveWorkbook can be replaced with any specific workbook object like: ThisWorkbook, Workbooks("NameOfFile.xls") etc
With ActiveWorkbook
.Sheets.Add .Sheets(1), , 2, xlChart
End With
End Sub
The arguments are [Before], [After], [Count], [Type]
In the code above, I put the .Sheets(1) as the [Before] argument. You could have also done that using it as the [After] argument. Of course the differences are obvious.
[Count] gives you the option to put the number of sheets to be added. and [Type] gives you the option to add the type of sheet. This could be either xlWorksheet, xlChart or even a few others.
Now, I understand this is not your only requirement, and it just forms a minor portion of what you're asking for. If you've got all that covered, good. Else, feel free to post back (since this is anyway a delayed post)
Bookmarks