DOC Office Consulting

DOC News

Add and name a new worksheet using VBA code

It’s easy to manually add and name a new sheet to your Excel workbook, but sometimes you need it to occur within your code. Here’s how you can create a new worksheet using VBA code:
Read Danielle O'Connell's answer to How do I add a single new sheet and name it using VBA in Excel? on Quora

Creating Multiple Worksheets using VBA

If you plan on creating multiple worksheets at once, you can create an array of worksheet names and then refer to each of them within a FOR loop.
add new worksheet using vba excel

Error Checking Before Adding New Worksheet using VBA

If you try and add a worksheet that has the same name as an existing worksheet it will create a run-time error. To avoid this problem, you can check if the worksheet name already exists before adding it.

UA-107044862-1