I am trying to do some conditional formatting in Excel for the font size but seeing as it can't be done from the format menu, it needs to be done with VBA.
I have a range B6 to however many rows and I want to look at the cell next to it and see if it's blank (column C). If it is then format the cell to Bold and 11pt. If it's not blank then it needs to be normal and 9pt.
My code at the minute only makes the last row Bold and 11pt and the rest of the column, even if column C is empty will be normal 9pt.
What is going wrong? BTW I'm using Excel 2003
Dim c As Range, rng
Dim LASTROW As Long
LASTROW = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Range("B6:B" & LASTROW)
For Each c In rng
If Len(c.Offset(1, 0)) = 0 Then
c.Font.Bold = True
c.Font.Size = 11
Else
c.Font.Bold = False
c.Font.Size = 9
End If
Next c
font size
:) – Siddharth Rout