4

I have a table in the range (G15:AL540) generated through SAP Query. I need to make all the rows Bold if the Cells in Column L Contains the word "Main Investigation". I did it using Conditional Formatting (=$L16="Main investigation") and it worked. But I need to write it in VBA, so that this formatting is applied automatically when the Query is refreshed.

Thanks!

Guillaume G
  • 313
  • 1
  • 2
  • 15
Sai
  • 43
  • 1
  • 1
  • 3

1 Answers1

4

This will only work for active sheet, change activesheet to sheets("sheetabc") to reference another sheet

Sub test()
With ActiveSheet
    For Each cell In .Range("G15:" & .Range("G15").End(xlDown).Address)
        If .Cells(cell.Row, 12).Value = "Main investigation" Then
            cell.EntireRow.Font.Bold = True
        End If
    Next
End With
End Sub
99moorem
  • 1,955
  • 1
  • 15
  • 27