Bonjour,
Petite question pour les pros
Je souhaiterai savoir si il est possible de faire un numberformat sur un tableau en mémoire, sa ne semble pas fonctionner, ou dois-je passer par un for each ?
Merci pour vos lumière
Sub FormatRoster()
Dim Dl As Long, sht As Variant, i As Long
Dl = Sheet8.Cells(Rows.CountLarge, 1).End(xlUp).Row
' Range("A2:A" & Dl).NumberFormat = "0000000"
sht = Sheet8.Range("A2:A" & Dl)
For i = LBound(sht, 1) To UBound(sht, 1)
If Len(sht(i, 1)) = 5 Then sht(i, 1) = sht(i, 1).NumberFormat = "000000"
If Len(sht(i, 1)) = 6 Then sht(i, 1) = sht(i, 1).NumberFormat = "0000000"
Debug.Print sht(i, 1)
Next i
Sheet8.Range("A2:A" & Dl) = sht
End Sub