There is an old archived topic with this title in which the author is looking to show the number of unique occurrences in the legend for a given attribute.
The macro had issues in that it had to be re-run each time, and then the legend had to be cut & pasted to force a refresh.
Now the macro seems to have a bigger issue in that Visual basic is no longer supported (as I understand it).
I am on 10sp2 looking for a way to address this same issue. Any suggestions in light of the demise of VB would be very appreciated. With the amount of VB resources that had been developed previously, it makes it very difficult to find non-VB solutions to these simple problems.
I'm not familiar with the script you are referring to but are you trying to get a feature count for the number of features in the visible extent? FYI - this has been added as a legend property at 10.1.