471,311 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,311 software developers and data experts.

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 5838
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.

Similar topics

reply views Thread by Radu | last post: by
reply views Thread by Radu | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.