I should have explained earlier how to assign a macro to a button. Ok, we'll do it step by step.
1. Open Excel.
2. Once in Excel press Alt + F11, then MS VBA opens.
3. On the left side of MS VBA you will see the Project Explorer. Look for the item ThisWorkbook and doubleclick it.
4. Click the menu item Insert, then click Procedure.
5. A small window opens asking for the name of the procedure. Write AddAllBold. For the Type choose Sub, and Scope Public. Then click OK.
6. The procedure AddAllBold() will be generated automatically and will appear at the center where you paste this code:
Dim c As Integer 'This is your counter
Dim i As Integer 'array counter
Dim rc As Integer 'row counter
Dim h As Integer
Dim x 'array
c = 0 'Initialize c to zero
i = 0 'initialize i to zero
rc = 0 'Initialize rc to zero
x = Array("B2", "B3") 'You could add as many rows you want
Range("B2").Select 'If you start the row at B2
Do Until ActiveCell.Value = ""
rc = rc + 1
ActiveCell.Offset(1, 0).Select
Loop
Range(x(i)).Select
For h = 1 To rc
Do Until ActiveCell.Value = ""
If ActiveCell.Font.Bold = True Then
c = c + 1
End If
ActiveCell.Offset(0, 1).Select
Loop
ActiveCell.Value = c
c = 0
i = i + 1
If i >= rc Then Exit Sub
Range(x(i)).Select
Next h
7. Make sure that the code is inside the Public Sub AddAllBold() ... End Sub.
8. Save your work, and go back to Excel.
9. Remember we are now in Excel. Now go to the menu item View, click it, go downwards, and click the item Toolbars. Put a check before the item Forms. The Forms window now appears on the screen.
10. On the Forms window click the button object, then bring the cursor on the Worksheet. Notice that the cursor has changed into a small cross.
11. Press the left mouse button, drag it downwards then to the right, and release it. A window with the name Assign Macro opens asking you to assign a macro to this button.
12. In the middle window you will see the item ThisWorkbook.AddAllBold. Choose this one, mark it, then click OK. Now you have assigned the macro to a button.
Hope I have explained thoroughly, and that you understood me.