SheetAdd_ANmar

Adds a sheet to a workbook, after checking if workbook is open
Checks if worksheet with that name is already found, then deletes it or not based on passed argument

CodeFunctionName
What is this?

Public

Tested

Original Work
Function SheetAdd_ANmar(SheetNa, Optional ThisWB = "", Optional DeleteitifFound = 0)
'
Rett = False
Createit = 0
If ThisWB = "" Then ThisWB = ThisWorkbook.Name
If FindFile(ThisWB) Then
If FindSheet(SheetNa, ThisWB) Then
If DeleteitifFound = 1 Then
SheetDelete_ANmar SheetNa, ThisWB
Createit = 1
End If
Else
Createit = 1
End If
If Createit = 1 Then
Workbooks(ThisWB).Worksheets.Add
Workbooks(ThisWB).ActiveSheet.Name = SheetNa
Rett = True
End If
End If
ByeBye:
SheetAdd_ANmar = Rett
End Function

SheetNa, Optional ThisWB = "", Optional DeleteitifFound = 0

Views 2,428

Downloads 860

CodeID
DB ID