How To Create New Sheet In Excel Vba

Creating a New Sheet in Excel VBA

To create a new sheet in Excel using VBA, you can use the Add method of the Sheets collection. Here’s an example:

Sub CreateNewSheet()
    Dim newSheet As Worksheet
    Set newSheet = ThisWorkbook.Sheets.Add
    newSheet.Name = "New Sheet"
End Sub

In this example, we define a new variable called newSheet of type Worksheet. We then use the Add method of the Sheets collection, accessed through ThisWorkbook, to create a new sheet and assign it to the newSheet variable.

We can set the name of the new sheet using the Name property. In this case, we set it to “New Sheet”. You can change this value to whatever you want.

Read more interesting post

Leave a comment