Skip to content

Commit 15402d6

Browse files
authored
Create createSheetIf
1 parent 0c547e9 commit 15402d6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

createSheetIf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Function CreateSheetIf(strSheetName As String) As Boolean
2+
'create a new sheet if doesn't exsiting
3+
4+
Dim wsTest As Worksheet
5+
CreateSheetIf = False
6+
7+
Set wsTest = Nothing
8+
On Error Resume Next
9+
Set wsTest = ActiveWorkbook.Worksheets(strSheetName)
10+
On Error GoTo 0
11+
12+
If wsTest Is Nothing Then
13+
CreateSheetIf = True
14+
Worksheets.Add.Name = strSheetName
15+
End If
16+
17+
End Function

0 commit comments

Comments
 (0)