FindSheet

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

Parameters

SheetName, Optional ThisWB

Views 116 Downloads 51

Perm link


ANmarAmdeen
280
Components VBA-Excel
Revisions

v1.0