Numéro de colonne Excel à partir du nom de colonne
Numéro de colonne Excel à partir du nom de colonne
Comment convertir un nom de colonne Excel (comme 'AA') en numéro de colonne ?
Re: Numéro de colonne Excel à partir du nom de colonne
**En formule :**
```
=COLONNE(INDIRECT(A1&"1"))
```
(où A1 contient la lettre de colonne)
**En VBA :**
```vba
Function LettreVersNum(lettre As String) As Long
LettreVersNum = Range(lettre & "1").Column
End Function
```
**En Python :**
```python
from openpyxl.utils import column_index_from_string
num = column_index_from_string('AA') # 27
```
```
=COLONNE(INDIRECT(A1&"1"))
```
(où A1 contient la lettre de colonne)
**En VBA :**
```vba
Function LettreVersNum(lettre As String) As Long
LettreVersNum = Range(lettre & "1").Column
End Function
```
**En Python :**
```python
from openpyxl.utils import column_index_from_string
num = column_index_from_string('AA') # 27
```