Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Deleting of names

Hello All

When I run my progran I use names the macro itself append number when
it is runned (xxxx); why??
How do I delete all theese names "Query_from_MS_Access_Database_xxxx"

Sub DeleteNames()
Dim sh As Workbook
On Error Resume Next

For t = 1 To 3500
x = "Query_from_MS_Access_Database_" & t
sh.Names(x).Delete
Next t

End Sub

This code does not work properly even if I change workbook to worksheet
and run i in the sheet or the workbook
Please help???
regards Kurt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Deleting of names

do you want to delete queries?
would this work for you?
got this here in the ng.

sub remove()
Dim MyQT As QueryTable
Dim i As Long
Dim j As Long
Dim sheet As Worksheet

For Each sheet In Sheets
i = sheet.Index
For j = Worksheets(i).QueryTables.Count To 1 Step -1
Set MyQT = Worksheets(i).QueryTables(j)
MyQT.Delete
Next
Next
end sub



--


Gary


"kurt" wrote in message
oups.com...
Hello All

When I run my progran I use names the macro itself append number when
it is runned (xxxx); why??
How do I delete all theese names "Query_from_MS_Access_Database_xxxx"

Sub DeleteNames()
Dim sh As Workbook
On Error Resume Next

For t = 1 To 3500
x = "Query_from_MS_Access_Database_" & t
sh.Names(x).Delete
Next t

End Sub

This code does not work properly even if I change workbook to worksheet
and run i in the sheet or the workbook
Please help???
regards Kurt



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Deleting of names

Helo Gary
Thank you for replying
I am not sure what you mean, but when I look in INSERT NAMES DEFINE I
have a lot (2000) of names Called "Query_from_MS_Access_Database_xxxx"
where xxxx is a number and they refer to "!#REF!"
I want to get rid of theese.


regards

Kurt



Gary Keramidas skrev:
do you want to delete queries?
would this work for you?
got this here in the ng.

sub remove()
Dim MyQT As QueryTable
Dim i As Long
Dim j As Long
Dim sheet As Worksheet

For Each sheet In Sheets
i = sheet.Index
For j = Worksheets(i).QueryTables.Count To 1 Step -1
Set MyQT = Worksheets(i).QueryTables(j)
MyQT.Delete
Next
Next
end sub



--


Gary


"kurt" wrote in message
oups.com...
Hello All

When I run my progran I use names the macro itself append number when
it is runned (xxxx); why??
How do I delete all theese names "Query_from_MS_Access_Database_xxxx"

Sub DeleteNames()
Dim sh As Workbook
On Error Resume Next

For t = 1 To 3500
x = "Query_from_MS_Access_Database_" & t
sh.Names(x).Delete
Next t

End Sub

This code does not work properly even if I change workbook to worksheet
and run i in the sheet or the workbook
Please help???
regards Kurt


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Deleting of names

This works for me

Sub DeleteNames()
Dim nme As Name

For Each nme In ActiveWorkbook.Names
If Left(nme.Name, 30) = "Query_from_MS_Access_Database_" Then _
nme.Delete
Next nme

End Sub



--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"kurt" wrote in message
oups.com...
Hello All

When I run my progran I use names the macro itself append number when
it is runned (xxxx); why??
How do I delete all theese names "Query_from_MS_Access_Database_xxxx"

Sub DeleteNames()
Dim sh As Workbook
On Error Resume Next

For t = 1 To 3500
x = "Query_from_MS_Access_Database_" & t
sh.Names(x).Delete
Next t

End Sub

This code does not work properly even if I change workbook to worksheet
and run i in the sheet or the workbook
Please help???
regards Kurt



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
Deleting Names in a Workbook Bill[_39_] Excel Programming 10 September 2nd 06 10:13 PM
deleting names from the name box Amy C Excel Discussion (Misc queries) 4 May 12th 06 11:00 AM
deleting duplicate names chris Excel Worksheet Functions 1 February 16th 06 08:42 PM
Deleting Names Rob Bovey Excel Programming 0 September 14th 04 08:30 PM
Deleting range names CiaraG[_4_] Excel Programming 1 May 10th 04 04:39 PM


All times are GMT +1. The time now is 10:08 PM.

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

About Us

"It's about Microsoft Excel"