ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete name range (https://www.excelbanter.com/excel-programming/313146-delete-name-range.html)

masterphilch

delete name range
 
Hi

I defined ranges (Insert Names Define). Now I want to delete the
reference with vba and keep the content of the cells, but I don't now how.

thanks a lot for help
masterphilch

Tom Ogilvy

delete name range
 
as example for a defined range with name "Name1"
ActiveWorkbook.Names("Name1").Delete

or to remove all names

Dim nm as Name
for each nm in Activeworkbook.Names
nm.Delete
Next

These are deleting the name definition, not the range they refer to.

--
Regards,
Tom Ogilvy


"masterphilch" wrote in message
...
Hi

I defined ranges (Insert Names Define). Now I want to delete the
reference with vba and keep the content of the cells, but I don't now how.

thanks a lot for help
masterphilch




masterphilch

delete name range
 
thanks!
It seems I've got a little different problem. My defined names are
sepcified for only one worksheet. They are generated by a sql-query.
It would be nice if you could help me again! Do I perhaps have to change
some parameters in my query (shown below)?

..name = "mitglieder_von_vka_tool"
..FieldNames = True
..RowNumbers = False
..FillAdjacentFormulas = False
..PreserveFormatting = True
..RefreshOnFileOpen = False
..BackgroundQuery = True
..RefreshStyle = xlInsertDeleteCells
..SavePassword = False
..SaveData = False
..AdjustColumnWidth = True
..RefreshPeriod = 0
..PreserveColumnInfo = True
..Refresh BackgroundQuery:=False

thanks

Tom Ogilvy wrote:
as example for a defined range with name "Name1"
ActiveWorkbook.Names("Name1").Delete

or to remove all names

Dim nm as Name
for each nm in Activeworkbook.Names
nm.Delete
Next

These are deleting the name definition, not the range they refer to.


Tom Ogilvy

delete name range
 
I don't think you want to delete the names if the query exists.

In any event, now I am not sure what you are asking.

--
Regards,
Tom Ogilvy

"masterphilch" wrote in message
...
thanks!
It seems I've got a little different problem. My defined names are
sepcified for only one worksheet. They are generated by a sql-query.
It would be nice if you could help me again! Do I perhaps have to change
some parameters in my query (shown below)?

.name = "mitglieder_von_vka_tool"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False

thanks

Tom Ogilvy wrote:
as example for a defined range with name "Name1"
ActiveWorkbook.Names("Name1").Delete

or to remove all names

Dim nm as Name
for each nm in Activeworkbook.Names
nm.Delete
Next

These are deleting the name definition, not the range they refer to.





All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com