Sep-10-2018, 01:09 AM
Hi,
I am using OpenPyXl and need to align different cells with different alignment values (center, right, bottom, etc.). My code seems to be ignoring my if statements. The center alignment is working.
Any clue what's wrong with the If statement? (I've also tried this:
Phil
I am using OpenPyXl and need to align different cells with different alignment values (center, right, bottom, etc.). My code seems to be ignoring my if statements. The center alignment is working.
Any clue what's wrong with the If statement? (I've also tried this:
if sheet['A1':'I43'] == 'Hz':)
# Cell Alignment al = Alignment(horizontal='center', vertical='center') br = Alignment(horizontal='right', vertical='bottom') for row in sheet['A1':'I43']: for cell in row: if cell == 'Hz': cell.alignment = br else: cell.alignment = alThanks,
Phil