Count Bold Numbers in Range - multiple rows

Q

QTE

Hello Excel Forum,

I need help with a procedure to count the number of numbers in "Bold
within a five cell range - columns AC:AG for every third row: startin
from row 7; next row 10, next row 13 etc.

The answer needs to placed in column AB, every third row: starting fro
row 6; next row 9, next row 12 etc.

This is what I've got so far (not much!):

Sub Count_Bold_Num()
Dim B As Object
Dim MyObject As Object
Dim Boldcount As Variant
Dim Counter As Integer

Set MyObject = Workbooks("test2").ActiveSheet
MyObject.Activate

For Each B In Range("ac7:ag7")
If B.Font.Bold = True Then
Boldcount = Boldcount + 1
Range("ab6").Value = Boldcount
End If
Next
End Sub

The above counts the bold cells for 1 row only and places the answer i
the designated cell(ab6), can you assist, so that it counts and place
the counted values in the relevant cells according to the above ro
designations.

Please assist with a working example.

Thank you
QT
 
K

kkknie

Try this:

Code
-------------------
Sub Count_Bold_Num()

Dim r As Range
Dim iBoldcount As Long
Dim iRow As Long

'=====No need to do this since the activesheet is as it says, active...
'Set MyObject = Workbooks("test2").ActiveSheet
'MyObject.Activate

For iRow = 7 To 100 Step 3
iBoldcount = 0
For Each r In Range("AC" & iRow & ":AG" & iRow)
If r.Font.Bold = True Then iBoldcount = iBoldcount + 1
Next
Range("AB" & iRow - 1).Value = iBoldcount
Next

End Su
 
Q

QTE

Hi K,

Thank you very much. Works like a dream.

QTE

Try this: Code
-------------------
Sub Count_Bold_Num()

Dim r As Range
Dim iBoldcount As Long
Dim iRow As Long

'=====No need to do this since the activesheet is as it says, active...
'Set MyObject = Workbooks("test2").ActiveSheet
'MyObject.Activate

For iRow = 7 To 100 Step 3
iBoldcount = 0
For Each r In Range("AC" & iRow & ":AG" & iRow)
If r.Font.Bold = True Then iBoldcount = iBoldcount + 1
Next
Range("AB" & iRow - 1).Value = iBoldcount
Next

End Su -------------------

K [/B
 
Top