Vba Create Worksheet With Name. And if the sheet name has been changed, your code wouldn't work until you change the name of the worksheet in the VBA code as well. The thing that makes it even stranger is that if you open the VBA editor to try and debug it, it then runs fine as well.
Note that the library contains many more than shown here. How to create and name a new worksheet with Visual Basic for Applications - VBA. Learn more about the Workbook and Worksheet object in Excel VBA.
There is another way to perform this activity.
In other words, Excel VBA programming involves working with an object hierarchy.
Function wsExists(wksName As String) As Boolean On Error Resume Next wsExists = CBool(Len(Worksheets(wksName). Once you start learning VBA one of the coolest things you can do is to write a VBA code to insert new a worksheet in a workbook. The fragments on this page and in the list below are included in the Code VBA library.