MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Macro to delete NAMES in a workbook...

Posted by Chris Rock on November 01, 2001 12:25 PM

Is there code I can run that will delete NAMES in a workbook?

I've got an external data query that runs each day, and it adds a new NAME each time it runs. By the end of a month, I'd have tons of NAMES in the workbook.

BY NAME, I am referring to Named Ranges.

Posted by Mark W. on November 01, 2001 12:42 PM

Why not have your macro Refresh your External Data
rather than recreating it or why don't you uncheck
the "Save query definition" option on the External
Data Range Properties dialog?

Posted by Lantos on November 01, 2001 2:24 PM

Sub Delete_All_Names()
Dim Nm As Name
For Each Nm In Names
End Sub

Posted by Mark W. on November 02, 2001 7:19 AM

No need to delete them if you don't create them (nt)

Posted by Lantos on November 02, 2001 2:03 PM

But he already has, hasn't he ? (nt)

I want to create a time sheet but I don't know how to add the hours up. eg 12:00 22:00 I know it equals 10 but how do I get it to do it automaticaly.

Assuming 12:00 in A1 and 22:00 in B1
then =b1-a1 will equal 10:00
=(B1-A1)*24 will equal 10. You may have to change format to general to show this properly.