I'm trying to delete all names from an excel workbook using VBA without using a loop.
I'm currently using the code below, but this is very slow as there are several thousand names in the workbook.
Any suggestions would be appreciated!
Sub deleteAllNames()
Dim xName As Name
For Each xName In Application.ActiveWorkbook.Names
xName.Delete
Next
End Sub
Not possible without some complicated hacky way or messing with the XML, but this should be faster:
Dim i As Long
Application.Calculation = xlCalculationManual
For i = ThisWorkbook.Names.Count To 1 Step -1
ThisWorkbook.Names(i).Delete
Next
Application.Calculation = xlCalculationAutomatic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With