Make cells bold using criteria

In column "A" put a "1" in cells 1 to 27. Put "2" in A28. Put any text in columns B & C 1 to 28. The macro will turn the cells at row 28 Bold. (By changing the position of 2, or adding additional 2's to column A, the other rows will also be made bold)

Sub TestMac()
   Dim c As Object
   For Each c In Range("a1:a28")
       If c.Value = 2 Then
           c.Offset(0, 1).Font.Bold = True
           c.Offset(0, 2).Font.Bold = True
           c.Offset(0, 1).Font.Bold = False
           c.Offset(0, 2).Font.Bold = False
       End If
End Sub

You might also like...


Neil Derek


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”