Bonjour à tous,
Baroute78, j'ai testé ton code, il est bien fonctionnel,
Un autre essai...en me basant sur ta proposition...
Sub diagonale()
Dim tb(100, 100), i%, j%
Application.ScreenUpdating = False
For i = 0 To UBound(tb, 1)
For j = 0 To UBound(tb, 2)
tb(i, j) = IIf(i = j, 1, 0)
Next j
Next i
With Sheets("Feuil1") ' à adapter
.Range("A1").Resize(100, 100) = tb
End With
Erase tb
End Sub
CTRL + e pour exécuter la macro.
Cordialement,