Vba add worksheet and rename worksheet in Excel

To do it in Excel, here is the answer:

  1. Option Explicit
  2. Sub AddAndNameWorkSheet()
  3. ThisWorkBook.Sheets.Add
  4. ActiveSheet.Name = "New Sheet"
  5. End Sub

Description:

a) Line 3 - Adds a WorkSheet. If position of the sheet is to be specified After or Before sheet name could be used (ThisWorkBook.Sheets.Add After:=Sheet1 or ThisWorkBook.Sheets.Add Before:=Sheet3)

b) Line 4 - Since by default after addition of sheet, the newly created sheet is activated, ActiveSheet object could be used to rename the newly created WorkSheet.

 

You can find similar Excel Questions and Answer hereunder

1) Import txt file in Excel

2) How can I identify the cells that influence a particular cell to help with debugging of my spreadSheet or understand a spreadSheet that I inherited?

3) How to add a link in a sheet to another sheet

4) How can worksheet functions be accessed in VBA?

5) How can I add a background image to a worksheet?

6) How can I add a legend to a chart using VBA?

7) How can I remove display of Gridlines in my worksheet using VBA?

8) How can I set the fill color, font color and set number format of cell to date?

9) How to create charts in Excel VBA

10) How can I loop through all ActiveX checkboxes in WorkSheet and set them to Unchecked status?

 

Here the previous and next chapter