Hi All,

I have the following code on frmSearch (userform) which i need to add some code to so that it presents a msgbox error if no results found when i click the findall button e.g. msgbox "No search results found", the search is defined by the user inputted text/string inputted in TextBox1 and the results are shown/filtered in ListBox1.

Private Sub UserForm_Initialize()
TextBox1.SetFocus
ListBox1.ColumnCount = 2
    Set myData = Sheet1.Range("a2").CurrentRegion
    With Me
        .Caption = "Search Database"
    End With
End Sub

Sub cmbFindAll_Click()
Dim strFind As String
Dim rFilter As Range
Dim ii As Long
Dim c As Range, a() As String, n As Long
Set rFilter = Sheet1.Range("a2", Range("a65536").End(xlUp))
strFind = Me.TextBox1.Value
With Sheet1
    If Not .AutoFilterMode Then .Range("A2").AutoFilter
    rFilter.AutoFilter Field:=1, Criteria1:="*" & strFind & "*"
        Set rng = Sheet1.Range("a2", Range("a65536").End(xlUp))
        Set rng = rng.Cells.SpecialCells(xlCellTypeVisible)
    For Each c In rng
        n = n + 1: ReDim Preserve a(0 To 11, 1 To n)
        For ii = 0 To 11
           a(ii, n) = c.Offset(, ii).Value
        Next
    Next
End With
If n > 0 Then Me.ListBox1.Column = a
End Sub

Any help you can offer would be much appreciated.

Many thanks, Matt