View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default Inaccurate count with code

On Tuesday, March 5, 2013 12:39:34 PM UTC-8, joeu2004 wrote:
"Howard" wrote:

Do see why this would return inaccurate counts


[....]

For Each wks In ActiveWorkbook.Worksheets


For Each c In rng


If c.Value = i Then ii = ii + 1


If c.Value = j Then jj = jj + 1


If c.Value = k Then kk = kk + 1


If c.Value = l Then ll = ll + 1


Next


Next wks




For one thing, rng does not refer to wks. Try:



For Each c In wks.rng


Thanks Joeu and Claus for taking a look.

This errors with method or data not found, with the ".rng" in blue

<For Each c In wks.rng

And per Claus's advice, I am running it from sheet 1.

Howard