Greetings!
As the title states, I was searching around the web for a simple code to do this, there are some already, but, none fully satisfied me, so I did a pretty simple one to achieve this, hope it helps someone
As the title states, I was searching around the web for a simple code to do this, there are some already, but, none fully satisfied me, so I did a pretty simple one to achieve this, hope it helps someone
Code:
Function CreateSheets(NameSheet As String, Optional Looked_Workbook As Workbook) As Boolean
If Looked_Workbook Is Nothing Then Set Looked_Workbook = ThisWorkbook
Dim SheetExists As Worksheet
On Error GoTo ExpectedErr01
Set SheetExists = Looked_Workbook.Worksheets(NameSheet)
CreateSheets = False
If 1 = 2 Then
ExpectedErr01: 'this means sheet didn't existed so, we are going to create it
CreateSheets = True
With Looked_Workbook
.Sheets.Add after:=.Sheets(.Sheets.Count)
ActiveSheet.Name = NameSheet
End With
End If
End Function