Wednesday, January 12, 2011

Code to count the tag in html page (VBA Code -Excel Macros)

Dim iCount As Integer
Sub findit()
Dim str As String

Dim iLen, iRes As Integer

iLen = Len(str)
For i = 2 To 557
str = Range("D" & i).Value
iCount = 0
iRes = howmany(str, " Range("M" & i).Value = iCount
Next i



End Sub

Function howmany(str As String, sSearch As String, iStart As Integer)
Dim iTemp, iRes As Integer
iTemp = InStr(iStart, str, sSearch)
iStart = iTemp

If iTemp = 0 Then
howmany = iCount
Else
iCount = iCount + 1
iTemp = howmany(str, sSearch, iStart + 1)
End If

End Function

No comments: