My Excel Macro
++++++++++++++

I have written a macro in Excel that allows me to check for the differences in outputs of two queries.
Now my boss wants me to highlight the cells instead of changing the font to bold and red.

I wrote some code after having experimented with excel a bit, but thats not working.

Here is my code.
VB Code:
  1. Sub MarkUniques()
  2.    
  3.     'Date       - 05-August-2005
  4.     'Author     - Abhijit Shrikhande
  5.     'Purpose    - To check the output from two different result sets.
  6.     '           - Works by highlighting the cells that are different.
  7.    
  8.     Dim iColCounter As Integer
  9.     Dim iColsToCheck As Integer
  10.     Dim lRowCounter As Long
  11.     Dim lRowsToCheck As Long
  12.    
  13.    
  14. 'Find out number of columns
  15.     iColCounter = 1
  16.     Do While Trim(Sheet1.Cells(1, iColCounter)) <> ""
  17.         iColCounter = iColCounter + 1
  18.     Loop
  19.         iColsToCheck = iColCounter - 1
  20.  
  21. 'Find out number of rows
  22.     lRowCounter = 1
  23.     Do While Trim(Sheet1.Cells(lRowCounter, 1)) <> ""
  24.         lRowCounter = lRowCounter + 1
  25.     Loop
  26.         lRowsToCheck = lRowCounter - 1
  27.  
  28. 'Start from 2nd Row, 1st Column
  29.     For lRowCounter = 2 To lRowsToCheck
  30.         For iColCounter = 1 To iColsToCheck
  31.             If Worksheets(1).Cells(lRowCounter, iColCounter) <> Worksheets(2).Cells(lRowCounter, iColCounter) Then
  32.                     Worksheets(2).Cells(lRowCounter, iColCounter).Font.Bold = True
  33.                     Worksheets(2).Cells(lRowCounter, iColCounter).Font.Color = vbRed
  34.                     '<--'Code fails at the next line -->
  35.                     Worksheets(2).Range(lRowCounter, iColCounter).Select
  36.                     With Selection.Interior
  37.                         .ColorIndex = 6
  38.                         .Pattern = xlSolid
  39.                     End With
  40.             End If
  41.         Next iColCounter
  42.     Next lRowCounter
  43. End Sub

Cheers,
Abhijit