Share via

Excel Macros, adding code to highlight numbers under 500

Anonymous
2025-03-04T16:35:37+00:00

Hello,

I am looking to run the following code, but to select numbers under 500 to do the following, but also to ignore an empty box. I would like to do this with my current Macro.

Sub HighlightUnder500()

'

' HighlightUnder500 Macro

  Selection.Font.Bold = True 

With Selection.Interior 

    .Pattern = xlSolid 

    .PatternColorIndex = xlAutomatic 

    .Color = 49407 

    .TintAndShade = 0 

    .PatternTintAndShade = 0 

End With 

End Sub
Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2025-03-04T18:32:52+00:00

    Thank you very much

    Was this answer helpful?

    0 comments No comments
  2. HansV 462.6K Reputation points
    2025-03-04T16:45:34+00:00

    Sub HighlightUnder500() With Selection.FormatConditions .Delete With .Add(Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""""") .Interior.ColorIndex = xlColorIndexNone End With With .Add(Type:=xlCellValue, Operator:=xlLess, Formula1:="=500") .Font.Bold = True .Interior.Color = 49407 End With End With End Sub

    Was this answer helpful?

    0 comments No comments