Syntax help!
So Mike, if you still want to go without a loop, you can try this:
Then, how about this:
Sub test()
Range("I18").Formula = _
Evaluate("=CountA('"& Sheets(3).Name & ":" & _
Sheets(Sheets.Count).Name & "'!A13:A100)")
End Sub
Regards,
KL
"Mike Fogleman" wrote in message
...
Got it. The audit sheet helped. Even though I changed the sheet number in
VBE properties of the 2 permanent sheets, they are still the first 2 tabs
in the workbook. So this line of code:
Worksheets.Add After:=Sheets(Sheets.Count)
That makes the first added sheet the 3rd tab, etc. So we really need to
deal with 3 to WorkSheets.Count, not 1 to WorkSheets.Count - 2.
Both the audit sheet and the main sheet loop match results of 750.
"Jim Cone" wrote in message
...
Mike,
Do an audit...
But first add a blank sheet as the last sheet.
'---------------------
Sub HowMany()
Dim dblCount As Double
Dim dblShtCnt As Double
Dim lngIndex As Long
For lngIndex = 1 To (Worksheets.Count - 2)
dblShtCnt = Application.CountA(Worksheets(lngIndex).Range("A13 :A100"))
Worksheets(Worksheets.Count).Cells(lngIndex, 2).Value =
Worksheets(lngIndex).Name
Worksheets(Worksheets.Count).Cells(lngIndex, 3).Value = dblShtCnt
dblCount = dblCount + dblShtCnt
dblShtCnt = 0
Next 'lngIndex
Range("I18").Value = dblCount
End Sub
'--------------------------
Jim Cone
San Francisco, USA
"Mike Fogleman" wrote in
message ...
True, but there are no charts. Could it be because the sheets are made on
the fly and the workbook has not been saved yet for Excel to recognize
the
sheets index?
"Jim Cone" wrote in message
...
Mike,
I don't know, however, fwiw, there can be a difference between
Sheets.Count and Worksheets.Count.
Jim Cone
San Francisco, USA
|