By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Comparing Columns in the excel

P: 17
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
  1.  
  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
  7.  
  8.  
#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)
  3.  
#I can also color the cells
rng=cell2.Range("C8")
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
Share this Question
Share on Google+
2 Replies


P: 17
got it! No need to respond :-0
Jul 30 '08 #2

P: 1
@jumperbl
Hi,

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.