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!
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