# -*- coding: iso-8859-1 -*- #. // _by_IntToCol.py #. // Transforme une colonne nCol en caractère. from mod import Mod def by_IntToCol( nCol ): cReturn = "" n = abs( nCol ) while n > 0: if int( Mod( n, 26 ) ) == 0: # // Pour le caractère "Z". cReturn = "Z" + cReturn n = int( n / 26 ) - 1 else: cReturn = chr( 64 + int( Mod( n, 26 ) ) ) + cReturn n = int( n / 26 ) #. endif #. enddo return cReturn ''' Dernière modification : 2022-03-03 [Exemple] from _by_IntToCol import by_IntToCol # // Transforme une colonne nCol en caractère. from _ex_ExcelNew import ex_ExcelNew # // Ouvre Excel. from _ex_WriteFormula import ex_WriteFormula # // Ecrit une formule dans une cellule avec options. oExcel = ex_ExcelNew() oBook = oExcel.Workbooks.Add() oSheet = oBook.Worksheets( 1 ) for c in range( 1, 30 + 1, 1 ): ex_WriteFormula( oSheet, 1, c, by_IntToCol( c ) ) oExcel.DisplayAlerts = False oExcel = None [/Exemple] '''