Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Removing named cells

I create and delete lots of cells in one of my excel applications. Each
cell has a named cell.
I have just noticed that I have a bunch of "bad"/"unreferenced" named cells.
I have a bunch of these
=Sheet1!#REF!

Is there a way I can go in and revove all of these programmatically?
Can you find named cells by REF?
thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Removing named cells

You could probably delete them manually by the time you developed the code to
do it. InsertNamedefine will bring up the listbox that has all of your
named ranges/cells so you can just pick the ones you want to delete and click
delete.

"greg" wrote:

I create and delete lots of cells in one of my excel applications. Each
cell has a named cell.
I have just noticed that I have a bunch of "bad"/"unreferenced" named cells.
I have a bunch of these
=Sheet1!#REF!

Is there a way I can go in and revove all of these programmatically?
Can you find named cells by REF?
thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Removing named cells

this may work (not tested)



Sub clearnames()
For Each rangename In ActiveWorkbook.Names
msg = MsgBox("Range Name: " & rangename.Name & Chr(10) & _
" REFERS TO: " & rangename & Chr(10) & Chr(10) & _
" Delete Name?", 36, "Delete Name")
If msg = 6 Then rangename.Delete
Next rangename
End Sub

--
jb


"greg" wrote:

I create and delete lots of cells in one of my excel applications. Each
cell has a named cell.
I have just noticed that I have a bunch of "bad"/"unreferenced" named cells.
I have a bunch of these
=Sheet1!#REF!

Is there a way I can go in and revove all of these programmatically?
Can you find named cells by REF?
thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Removing named cells

see if this does what you want:

Sub name_ranges2()
Dim nm As Name

Select Case MsgBox("Are you Sure You Want To Delete All Named Ranges (#REF)?", _
vbOKCancel Or vbExclamation Or vbDefaultButton1, Application.Name)
Case vbOK
For Each nm In ThisWorkbook.Names
If nm Like "*REF*" Then
nm.Delete
End If
Next nm
Case vbCancel
Exit Sub
End Select

End Sub

--


Gary


"greg" wrote in message
...
I create and delete lots of cells in one of my excel applications. Each cell
has a named cell.
I have just noticed that I have a bunch of "bad"/"unreferenced" named cells.
I have a bunch of these
=Sheet1!#REF!

Is there a way I can go in and revove all of these programmatically?
Can you find named cells by REF?
thanks





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Removing named cells


missed a character that may make it safer:

If nm Like "*REF!*" Then
--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
see if this does what you want:

Sub name_ranges2()
Dim nm As Name

Select Case MsgBox("Are you Sure You Want To Delete All Named Ranges (#REF)?",
_
vbOKCancel Or vbExclamation Or vbDefaultButton1, Application.Name)
Case vbOK
For Each nm In ThisWorkbook.Names
If nm Like "*REF*" Then
nm.Delete
End If
Next nm
Case vbCancel
Exit Sub
End Select

End Sub

--


Gary


"greg" wrote in message
...
I create and delete lots of cells in one of my excel applications. Each cell
has a named cell.
I have just noticed that I have a bunch of "bad"/"unreferenced" named cells.
I have a bunch of these
=Sheet1!#REF!

Is there a way I can go in and revove all of these programmatically?
Can you find named cells by REF?
thanks









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Removing named cells

thanks, I will give it a try


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...

missed a character that may make it safer:

If nm Like "*REF!*" Then
--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
see if this does what you want:

Sub name_ranges2()
Dim nm As Name

Select Case MsgBox("Are you Sure You Want To Delete All Named Ranges
(#REF)?", _
vbOKCancel Or vbExclamation Or vbDefaultButton1, Application.Name)
Case vbOK
For Each nm In ThisWorkbook.Names
If nm Like "*REF*" Then
nm.Delete
End If
Next nm
Case vbCancel
Exit Sub
End Select

End Sub

--


Gary


"greg" wrote in message
...
I create and delete lots of cells in one of my excel applications. Each
cell has a named cell.
I have just noticed that I have a bunch of "bad"/"unreferenced" named
cells.
I have a bunch of these
=Sheet1!#REF!

Is there a way I can go in and revove all of these programmatically?
Can you find named cells by REF?
thanks









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Named Ranges WINS Excel Discussion (Misc queries) 4 February 2nd 09 06:39 PM
Removing `named range´ from worksheet Gregory Excel Discussion (Misc queries) 3 February 15th 07 07:54 PM
Excell named cells or labeled cells question [email protected] Excel Programming 8 June 25th 06 05:15 PM
Excel named cells or labeled cells question [email protected] Excel Programming 2 June 25th 06 04:39 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM


All times are GMT +1. The time now is 01:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"