Нужна такая вот функция:
Function search(sheet As String, column As String, val As Variant) As Integer
'Ïîäñ÷åò êîëè÷åñòâà ÷åãî-íèáóäü, ãäå-íèáóäü
Dim s As Range
With Worksheets(CStr(sheet)).Range(column + "1:" + column + "10000")
Set s = .Find(What:=val, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
If Not s Is Nothing Then
search = 1
r = s.Row
Do
Set s = .FindNext(After:=s)
If Not s Is Nothing Then
search = search + 1
End If
Loop Until s Is Nothing Or r = s.Row
Else: search = 0
End If
End With
End Function
Findnext не находит ничего. Что здесь не так?
Ответить
|