THIS is my code
Sub tester()
CompareCols ActiveSheet.Range("c3:c50"), _
Workbooks("round+merge.xls").Sheets("sheet3").Range("c3:c50")
End Sub
Sub CompareCols(col1 As Range, col2 As Range)
Dim val1, val2, x
col1.Font.ColorIndex = 0
loop through cells in the first column
For x = 1 To 50 'col1.Cells.Count
val1 = col1.Cells(x).Value
if cell is not blank
If val1 <> "" Then
val2 = col2.Cells(x).Value
Select Case True
Case val1 > val2: col1.Cells(x).Font.Color = vbRed
Case val1 < val2: col1.Cells(x).Font.Color = RGB(0, 128, 0)
Case val1 = val2: col1.Cells(x).Font.Color = vbBlue
End Select
End If
Next x
Call tester1
End Sub
now this works well till it comes to cell c49
then it gives the error in the foll. line
"Case val1 > val2: col1.Cells(x).Font.Color = vbRed".
and this code work for one col that is C if i want it for others do i
have copy the code and change the col from c to other.
i will tell u the cols that i want are c,f,i,l,o,r,u,x,aa etc.
and there was one problm the colour of c3 & c4 didn't change rest all
worked well