Excel Tutorials | Formatting macros Codes

Highlight Greater than Values

Sub HighlightGreaterThanValues() Dim i As Integer i = InputBox(“Enter Greater Than Value”, “Enter Value”) Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, _ Operator:=xlGreater, Formula1:=i Selection.FormatConditions(Selection.FormatConditions.Count).S tFirstPriority With Selection.FormatConditions(1) .Font.Color

Read More »

Highlight Lower Than Values

Sub HighlightLowerThanValues() Dim i As Integer i = InputBox(“Enter Lower Than Value”, “Enter Value”) Selection.FormatConditions.Delete Selection.FormatConditions.Add _ Type:=xlCellValue, _ Operator:=xlLower, _ Formula1:=i Selection.FormatConditions(Selection.FormatConditions.Count).S tFirstPriority With

Read More »

Highlight Negative Numbers

Sub highlightNegativeNumbers() Dim Rng As Range For Each Rng In Selection If WorksheetFunction.IsNumber(Rng) Then If Rng.Value < 0 Then Rng.Font.Color= -16776961 End If End If

Read More »

Highlight Named Ranges

Sub HighlightRanges() Dim RangeName As Name Dim HighlightRange As Range On Error Resume Next For Each RangeName In ActiveWorkbook.Names Set HighlightRange = RangeName.RefersToRange HighlightRange.Interior.ColorIndex =

Read More »