Something like this. which simply selects sheet1 and sheet3 in the active workbook.
Sub x()
Dim sh_array(2)
Dim shtTemp As Object
Dim sh_NewArray()
sh_array(0) = "Sheet1"
sh_array(1) = ""
sh_array(2) = "Sheet3"
sh_NewArray = CompressArray(sh_array)
Sheets(sh_NewArray).Select
For Each shtTemp In ActiveWindow.SelectedSheets
MsgBox shtTemp.Name
Next
End Sub
Function CompressArray(Old()) As Variant()
Dim lngIndex As Long
Dim lngNitems As Long
Dim vntTemp()
For lngIndex = LBound(Old) To UBound(Old)
If Len(Old(lngIndex)) > 0 Then
ReDim Preserve vntTemp(lngNitems)
vntTemp(lngNitems) = Old(lngIndex)
lngNitems = lngNitems + 1
End If
Next
CompressArray = vntTemp
End Function
Bookmarks