Hi All,
Can anyone please give a try, I use the below code for highlighting positive and negative, however, I want to highlight if the positive amount is split into two different numbers.
Sub Knock_Off_Click()
Dim StartRow As Long, EndRow As Long
Dim rngCell As Range, rngMyData As Range
Dim MyCount As Long
StartRow = 3 'Starting row number for the data. Change to suit.
EndRow = Range("D:D").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Set rngMyData = Range("D" & StartRow & ":D" & EndRow)
Application.ScreenUpdating = False
For Each rngCell In rngMyData
If Len(rngCell) > 0 And rngCell.Interior.Color = 16777215 Then
If MyCount > 10 Then
MyCount = 1
Else
MyCount = MyCount + 1
End If
Call HighlightOppositeSign(rngCell.Address, rngMyData.Address, MyCount)
End If
Next rngCell
Set rngMyData = Nothing
MyCount = 0
Application.ScreenUpdating = True
End Sub
Sub HighlightOppositeSign(strCellAddress As String, strDataRange As String, MyCount As Long)
Dim rngCell As Range, rngMyData As Range
Dim MyAmt As Double
MyAmt = CDbl(Range(strCellAddress))
For Each rngCell In Range(strDataRange)
If rngCell.Address <> strCellAddress Then
If rngCell.Value = MyAmt * -1 Then
If rngCell.Interior.Color = 16777215 Then
Select Case MyCount
Case Is = 1
Range(strCellAddress).Interior.Color = RGB(255, 255, 153)
rngCell.Interior.Color = RGB(255, 255, 153)
Exit For
End Select
End If
End If
End If
Next rngCell
End Sub