Created
May 25, 2011 15:43
-
-
Save jollychang/991206 to your computer and use it in GitHub Desktop.
ad_monitor_counter.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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