Be the first user to complete this post
|
Add to List |
VBA-Excel: Create Dynamic or Run-time WorkSheets using Macro.
To Create Dynamic or Run-time WorkSheets using Macro, follow the steps mentioned below
Steps:
- Get the Active WorkBook object
- Add the worksheets at the run time using Add().Name() method
Get the Active WorkBook object
Set mainWorkBook = ActiveWorkbook
Add the worksheets at the run time using Add().Name() method
mainWorkBook.Worksheets.Add().Name = “Sheet Name”
Complete Code:
Sub DynamicWorkSheets() Dim mainWorkBook As Workbook Set mainWorkBook = ActiveWorkbook For i = 1 To 3 mainWorkBook.Worksheets.Add().Name = "DynamicWS_" & i Next End Sub
![Dynamic WorkSheets](/static/media/excel/2013/07/Dynamic-WorkSheets.jpg)
Also Read:
- VBA-Excel: Copy/Paste data - Copy the Entire data from one sheet to another
- VBA-Excel: Get all the WeekDays or Working days in Specified Date Range, (excluding Satudays and Sundays)
- VBA-Excel: CurrentRegion
- Add Tools to Quick Access Tool Bar(Excel Top Bar)
- Excel Macro - Visual Basic Editor