Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have written a macro that matches values in two columns and highlights the matches. The problem arises in a loop that is searching in one column has no match in the other. The code generates an error. Any input appreciated, code follows. Sub Match() 'Compares values in 2 columns and highlights if the same For Nextloop = 1 To 50 ActiveCell.Offset(1, 0).Activate i = 1 Do Until ActiveCell.Value = Range("b1").Offset(i, 0) i = i + 1 Loop If ActiveCell.Value = Range("b1").Offset(i, 0) Then Range("b1").Offset(i, 0).Cells.Interior.ColorIndex = 17 If IsEmpty(ActiveCell) Then Exit Sub End If End If Next Nextloop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Matching Values in Two Columns | Excel Discussion (Misc queries) | |||
Find matching values in two different columns | Excel Worksheet Functions | |||
Matching values in 2 columns | Excel Discussion (Misc queries) | |||
Matching values in two columns | Excel Discussion (Misc queries) | |||
Matching values in 2 columns | Excel Programming |