Comparing Columns in the excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jumperbl
    New Member
    • Mar 2008
    • 17

    Comparing Columns in the excel

    I want to look at two columns lets say B1 to B8 and C1 to C8. I want to compare those ranges and if the columns don't match i want to color the cell. Here is how much i have figured out.
    Code:
    import win32com.client
    xlApp = win32com.client.Dispatch("Excel.Application")
    xlApp.Visible=1
    xlWb = xlApp.Workbooks.Open(r"C:\Template_Rev_3.2.xls")
    print xlApp.Worksheets("sheet1").Name
    #I can open the excel and I can parse through the cells and print the values also:

    Code:
    for x in cell2.Range("B8","B78"):
         print str(x)
    #I can also color the cells
    rng=cell2.Range ("C8")
    rng.Interior.Co lorIndex = 6

    #BUT HOW DO I COMPARE TWO COLUMNS B8 and C8, B9 and C9, B10 and C10...and color them if they are different easily?
  • jumperbl
    New Member
    • Mar 2008
    • 17

    #2
    got it! No need to respond :-0

    Comment

    • moshim
      New Member
      • Jan 2019
      • 1

      #3
      Originally posted by jumperbl
      got it! No need to respond :-0
      Hi,

      Can you please share the code?

      Comment

      Working...