Hi everyone
I'm new to VBA and I'm struggling to add an Error Message which is only shown, if there is no project in the slicer matching the users input. By now, the meassage is always shown, even if a matching project is found.
And here is my ErrorHandler:
Maybe someone can help me?
I'm new to VBA and I'm struggling to add an Error Message which is only shown, if there is no project in the slicer matching the users input. By now, the meassage is always shown, even if a matching project is found.
Code:
Dim si As SlicerItem, fi As SlicerItem
'si item in slicer, fi Input des Users
Dim msg As String
With ActiveWorkbook.SlicerCaches(1)
On Error GoTo ErrorHandler
'if there is no matching Project, goto ErrorHandler
Set fi = .SlicerItems(CStr(Sheets("Neu").Range("A90")))
'Cell Input from A90 is fi
fi.Selected = True
For Each si In .VisibleSlicerItems
If si.Name <> fi.Name Then si.Selected = False
Next
End With
And here is my ErrorHandler:
Code:
ErrorHandler:
MsgBox "Projekt nicht gefunden", vbOKOnly, "Fehler"
On Error GoTo 0
End Sub
Maybe someone can help me?