Finds a sheet in a workbook, if no workbook name passed, it will use ThisWorkbook.
Returns true if found, or false if not
Function FindSheet(SheetName, Optional ThisWB = "") As Boolean
' Searches for a sheet in a workbook
' Can also be used as User-Defined-Function
If ThisWB = "" Then ThisWB = ThisWorkbook.Name
FindSheet = False
If SheetName = "" Then Exit Function
For I = 1 To Workbooks(ThisWB).Sheets.Count
If UCase(SheetName) = UCase(Workbooks(ThisWB).Sheets(I).Name) Then
FindSheet = True
Exit Function
End If
Next I
End Function
' Searches for a sheet in a workbook
' Can also be used as User-Defined-Function
If ThisWB = "" Then ThisWB = ThisWorkbook.Name
FindSheet = False
If SheetName = "" Then Exit Function
For I = 1 To Workbooks(ThisWB).Sheets.Count
If UCase(SheetName) = UCase(Workbooks(ThisWB).Sheets(I).Name) Then
FindSheet = True
Exit Function
End If
Next I
End Function
SheetName, Optional ThisWB
Views 4,831
Downloads 1,509
CodeID
DB ID
ANmarAmdeen
626
Revisions
v2.0
Sunday
March
31
2019