Dim ClRj As Variant, i%, j%
For i = 7 To 23 Step 4
For j = Asc("E") To Asc("Y") Step 4
ClRj(i, j) = Chr(j) & i
MsgBox (ClRj(i,j) & " : " & Range(ClRj(i,j)))
Next j
Next i
'en array, ok :
'ClRj = Array( _
' Array("E7", "I7", "M7", "Q7", "U7", "Y7", "AC7"), _
' Array("E11", "I11", "M11", "Q11", "U11", "Y11", "AC11"), _
' Array("E15", "I15", "M15", "Q15", "U15", "Y15", "AC15"), _
' Array("E19", "I19", "M19", "Q19", "U19", "Y19", "AC19"), _
' Array("E23", "I23", "M23", "Q23", "U23", "Y23", "AC23"))
Sub toto()
Dim ClRj(7 To 23, 69 To 89) As Variant, i%, j%
For i = 7 To 23 Step 4
For j = Asc("E") To Asc("Y") Step 4
ClRj(i, j) = Chr(j) & i
MsgBox (ClRj(i, j) & " : " & Range(ClRj(i, j)))
Next j
Next i
End Sub
Option Explicit
Const k& = 64 'Ajuster la constante : A ~ k+1
Function ColNum2&(s$)
ColNum2 = Columns(s).Column + k
End Function
Function NumCol2$(c&)
NumCol2 = Split(Columns(c - k).Address(0, 0), ":")(0)
End Function
Function ColNum&(s$)
Dim i&, u&
For i = 1 To Len(s)
u = u * 26 + Asc(Mid$(s, i, 1)) - 64
Next
ColNum = u + k
End Function
Function NumCol$(c&)
Dim u$, r&
c = c - k
Do
r = (c - 1) Mod 26
c = (c - r) \ 26
u = Chr(r + 65) & u
Loop While c > 0
NumCol = u
End Function
Option Explicit
Sub TArray()
Dim n As Byte, ClRj() 'ou ClRj tout court
ClRj = Array(1, "a", 3)
For n = 0 To 2
MsgBox ClRj(n)
Next
End Sub
Option Explicit
Sub Tablo()
Dim i As Byte, j As Byte, ClRj(23, 29)
For i = 7 To 23 Step 4
For j = 5 To 29 Step 4
ClRj(i, j) = Cells(i, j).Address
Next
Next
For i = 7 To 23
For j = 5 To 29
MsgBox ClRj(i, j) 'ou Replace(ClRj(i,j),"$","") pour des adresses relatives
Next
Next
End Sub
(...)
sinon, je me permets de remettre mon edit: je ne peux lire les formats xlsm
(...)
mais je n'ai pas bien compris pourquoi cela marchait de cette façon et pas d'une autre. En déclarant 'dim ClRj As Variant', tout court, et en définissant la matrice avec array (comme indiqué dans le bout de code) cela marchait aussi