DELETE NAMES

  • Thread starter Thread starter gus
  • Start date Start date
for each nm in ThisWorkbook.Names
if Ucase(Left(nm.name,1)) = "F" then
nm.Delete
end if
Next
 
Tom..

Finally.. I can correct the master :)

Your code will remove a name like Form1!number..
Following should be a bit more precise.


Sub NameFkiller()
Dim nm As Name
For Each nm In ActiveWorkbook.Names
If nm.Name Like "*[!]f*" Or _
(nm.Name Like "f*" And Not nm.Name Like "*[!]*") Then
nm.Delete
End If
Next
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
Good correction, but probably Overcome by Events. Based on his other posts,
he is just trying to delete one corrupted name. (and it appeared to be
workbook level <g>).

--
Regards,
Tom Ogilvy

keepitcool said:
Tom..

Finally.. I can correct the master :)

Your code will remove a name like Form1!number..
Following should be a bit more precise.


Sub NameFkiller()
Dim nm As Name
For Each nm In ActiveWorkbook.Names
If nm.Name Like "*[!]f*" Or _
(nm.Name Like "f*" And Not nm.Name Like "*[!]*") Then
nm.Delete
End If
Next
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >


Tom Ogilvy said:
for each nm in ThisWorkbook.Names
if Ucase(Left(nm.name,1)) = "F" then
nm.Delete
end if
Next
 
Back
Top