» Create new workbooks using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - Files, Workbook, and Worksheets in VBA
VERSION - All Microsoft Excel Versions
You can use the macro like this if you want to create a new workbook with 10 worksheets:
Set wb = NewWorkbook(10)
Function NewWorkbook(wsCount As Integer) As Workbook
' creates a new workbook with wsCount (1 to 255) worksheets
Dim OriginalWorksheetCount As Long
Set NewWorkbook = Nothing
If wsCount < 1 Or wsCount > 255 Then Exit Function
OriginalWorksheetCount = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = wsCount
Set NewWorkbook = Workbooks.Add
Application.SheetsInNewWorkbook = OriginalWorksheetCount
End Function
Book Store:
Recommended Books:
- Lower Your Taxes - Big Time! : Wealth-Building, Tax Reduction Secrets from an IRS Insider
- Mortgages For Dummies®
- How to Use Financial Statements: A Guide to Understanding the Numbers
- How to Pay Zero Taxes (Annual)
- Special Edition Using Microsoft Office XP
- Financial Reporting and Analysis (2nd Edition)
No comments have been submitted.

