It may be better to use a collection rather than an array - no need to resize then.
Sub Test()
Dim vSheetNames As Variant
Dim sht As Variant
Dim colMissing As Collection
Dim vItem As Variant
Dim sMissingString As String
Dim lLastComma As Long
vSheetNames = Array("Sheet1") ', "Sheet2", "Sheet3", "Sheet4", "Sheet5"
'Build a collection of missing sheets.
Set colMissing = New Collection
For Each sht In vSheetNames
If Not WorkSheetExists(CStr(sht)) Then
colMissing.Add sht
End If
Next sht
If colMissing.Count = 0 Then
MsgBox "All sheets are present", vbOKOnly + vbInformation
Else
'Build the message string.
For Each vItem In colMissing
sMissingString = sMissingString & vItem & ", "
Next vItem
'Remove the last comma.
sMissingString = Left(sMissingString, Len(sMissingString) - 2)
'Replace last comma with the word 'and'.
lLastComma = InStrRev(sMissingString, ",")
If lLastComma > 0 Then
sMissingString = Left(sMissingString, lLastComma - 1) & " and" & Mid(sMissingString, lLastComma + 1)
End If
MsgBox IIf(colMissing.Count = 1, "This sheet is ", "These sheets are ") & "missing: " & vbCr & _
sMissingString, vbOKOnly + vbInformation
End If
End Sub
Public Function WorkSheetExists(SheetName As String, Optional WrkBk As Workbook) As Boolean
Dim wrkSht As Worksheet
If WrkBk Is Nothing Then
Set WrkBk = ThisWorkbook
End If
On Error Resume Next
Set wrkSht = WrkBk.Worksheets(SheetName)
WorkSheetExists = (Err.Number = 0)
Set wrkSht = Nothing
On Error GoTo 0
End Function