There are two sheets Kevin and James. Both the sheets have unique code numbers and rates. The code below is to find out the unique code numbers in both sheets and the highest rates among the unique codes and result will be in a separate Summary sheet. Could you let me know where the code is wrong.
Sub Loop10Q4Ver1()
Sheets("Kevin").Select
Range("A2").Select
Sheets("James").Select
Range("A2").Select
Sheets("Summary").Select
Range("A2").Select
Do
Sheets("Kevin").Select
varcode = ActiveCell
varrate = ActiveCell.Offset(0, 1)
ActiveCell.Offset(1, 0).Select
Do
Sheets("James").Select
If ActiveCell = varcode Then
Sheets("Summary").Select
ActiveCell = varcode
ActiveCell.Offset(1, 0).Select
Else
Sheets("James").Select
ActiveCell.Offset(1, 0).Select
End If
Sheets("James").Select
If ActiveCell.Offset(0, 1) > varrate Then
Sheets("Summary").Select
ActiveCell.Offset(0, 1) = varrate
Else
Sheets("James").Select
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell)
Loop Until IsEmpty(ActiveCell)
End Sub