View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default What's wrong with this

That looks fine (now).



Brad wrote:

Thank you that worked - are there other items that I should change to make
this a better function?

"Chip Pearson" wrote:

Brad,

Change
If Cells.Font.Size = Whatfont Then
to
If Rng.Font.Size = Whatfont Then


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Brad" wrote in message
...
I'm trying to count the number of times a cell has a font size
of 22, and it
is giving me zero. I'm new to this stuff would appreciate any
help.

Function countbyfont(InRange As Range, _
Whatfont As Integer, _
Optional ofText As Boolean = False) As Long
Dim Rng As Range
Application.Volatile (True)

For Each Rng In InRange.Cells
If Cells.Font.Size = Whatfont Then
countbyfont = countbyfont + 1
End If
Next Rng

End Function





--

Dave Peterson