hdf presented the following explanation :
I've been searching extensively and can't seem to find something that
works, so I will try here.
I need to develop vba code that will delete all cell names within a
selected range. The selected range will include cells that are named
and cells that are not named.
Any help will be greatly appreciated.
Have a look at the Intersect() function in VBA help.
Example...
<aircode
Dim rngname As Variant
' For Each rngname In ActiveWorkbook.Names '//use for global scope
For Each rngname In ActiveSheet.Names '//use for local scope
If Not Intersect(Selection, Range(rngname)) Is Nothing Then
'..delete the name
' ActiveWorkbook.Names(rngname).Delete '//use for global scope
ActiveSheet.Names(rngname).Delete '//use for local scope
End If
Next 'rngname
...where this will work if all or part of a named range falls within the
selection.
--
Garry
Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion