468,505 Members | 1,827 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

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.
Expand|Select|Wrap|Line Numbers
  2. import win32com.client
  3. xlApp = win32com.client.Dispatch("Excel.Application")
  4. xlApp.Visible=1
  5. xlWb = xlApp.Workbooks.Open(r"C:\Template_Rev_3.2.xls")
  6. print xlApp.Worksheets("sheet1").Name
#I can open the excel and I can parse through the cells and print the values also:

Expand|Select|Wrap|Line Numbers
  1. for x in cell2.Range("B8","B78"):
  2.      print str(x)
#I can also color the cells
rng.Interior.ColorIndex = 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?
Jul 30 '08 #1
2 5682
got it! No need to respond :-0
Jul 30 '08 #2

Can you please share the code?
Jan 7 '19 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.