Hi,
I have a sheet which contains credits and debits for several accounts:
[TABLE="class: cms_table"]
[tr][td]Customer
[/td][td]Amount
[/td][/tr][tr][td]ABC
[/td][td]2000
[/td][/tr][tr][td]XYZ
[/td][td]3000
[/td][/tr][tr][td]XYZ
[/td][td]1000
[/td][/tr][tr][td]ABC
[/td][td]1000
[/td][/tr][tr][td]ABC
[/td][td]-5000
[/td][/tr][tr][td]XYZ
[/td][td]1000
[/td][/tr]
[/TABLE]
What I need to do is match negative and positive values within each account and highlight them. I have been able to put together a VBA code from google and this forums to match within all rows.
Code
Sub matchdata()
On Error Resume Next
For Each cl In Columns(10).SpecialCells(2, 1)
Err.Clear
x = Columns(1).Find(-cl.Value, cl.Offset(1), xlValues, 1).Activate
If Err.Number = 0 Then
With Selection.Interior
.ColorIndex = 2
End With
cl.Interior.ColorIndex = 2
End If
Next
End Sub
Display More
I need to adapt the code so as to do matching within accounts. Example within ABC and XYZ separately.There will be 100s of accounts.
Please help!!