Function to determine if a specified worksheet contains data.
Includes optional parameter to specify workbook
Author: michael@excelexperts.co.uk
Function DoesWsExist(WorksheetName As String, Optional WorkbookName As String) As Boolean
Dim ws As Worksheet
On Error Resume Next
If WorkbookName = vbNullString Then
Set ws = Sheets(WorksheetName)
Else
Set ws = Workbooks(WorkbookName).Sheets(WorksheetName)
End If
On Error GoTo 0
DoesWsExist = Not ws Is Nothing
End Function