Подсчет общего количества запросов
, которые вы также можете использовать CountIF()
, всегда явно указывать ссылки на диапазон до требуемого листа
наконец, следуйте совету Матье Гиндона
следующим образом:
With Sheet1
Set foundCell = .Cells.Find(What:="B-32", After:=.Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Not foundCell Is Nothing Then
MsgBox ("""Bingo"" found " & WorksheetFunction.CountIf(.Cells, "*B-32*") & " times")
MsgBox ("first ""Bingo"" found in row " & foundCell.Row)
Me.Location.Text = .Cells(foundCell.Row, 3).Value
Me.Office.Value = .Cells(foundCell.Row, 2).Value
Me.Floor.Value = .Cells(foundCell.Row, 1).Value
Me.Status.Value = .Cells(foundCell.Row, 4).Value
Me.telephone.Value = .Cells(foundCell.Row, 5).Value
Me.mobile.Value = .Cells(foundCell.Row, 6).Value
Me.owner.Value = .Cells(foundCell.Row, 7).Value
Me.Notes.Value = .Cells(foundCell.Row, 8).Value
Else
MsgBox ("Bingo not found")
End If
End With