hmm,
19 million cells involved, some with formulae.
this problem is getting more interesting
try this code
it allows for 4400x4400 (=19.36 million cells) but can change to whatever you like. took me about 1.4 secs for data without formulae starting from active cell A1, but haven't tested it with formulae
Sub diag2()
Dim n&, i&, u As Range, s As String, adr As String
n = 4400
Application.Calculation = xlManual
With ActiveCell.Resize(n, n)
For i = 1 To n - 1
adr = .Cells(i + 1, i).Resize(n - i).Address(0, 0)
If Len(s & "," & adr) < 255 Then
s = s & "," & adr
Else
.Range(Mid(s, 2)).ClearContents
s = "," & adr
End If
Next i
If Len(s) > 0 Then .Range(Mid(s, 2)).ClearContents
End With
Application.Calculation = xlAutomatic
End Sub
Bookmarks