Skip to content

Instantly share code, notes, and snippets.

@jollychang
Created May 25, 2011 15:43
Show Gist options
  • Save jollychang/991206 to your computer and use it in GitHub Desktop.
Save jollychang/991206 to your computer and use it in GitHub Desktop.
ad_monitor_counter.bas
Dim s_number As Integer
Sub main()
s_number = Sheets.Count
ad_counter "宝马汽车"
ad_counter "节目预告(宝马汽车)"
End Sub
Function ad_counter(adname)
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = adname
For i = 2 To s_number
counter = Application.WorksheetFunction.CountIf(Sheets(i).[H:H], "=" & adname)
Worksheets(Sheets.Count).Cells(i - 1, 2) = Sheets(i).Name
Worksheets(Sheets.Count).Cells(i - 1, 3) = counter
Next i
Columns("B:B").EntireColumn.AutoFit
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment