LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Create, delete and re-use a range name

John

Just to reiterate from my prior post:

I create a valid query table in Excel (using MS Query) and always append
"_1" to the data range name.
I SAVE the workbook.
Then, I run my code. If something goes wrong and Excel starts incrementing
the data range name....I close the workbook, open the saved copy, amend the
code, and save the workbook again. I repeat the process until I get the
desired results. After that, I don't have to worry about incrementing names.

There may be a different/better way to achieve the same results, but I was
thankful to find even one method that worked. Really....one Excel starts
autonumbering the data range name, it tenaciously continues to.

I hope that helps.
***********
Regards,
Ron

XL2002, WinXP


"John Keith" wrote:

I am having the same issue... _1 _2 or no _# appending to the named range
of my QueryTable.

I am deleting and re-creating the Names and QTs each time but still have the
issue. When a RngName_1 was autocreated by the query .add, the it is the only
range name attached to the sheet. This makes no sense why the query.add
would choose to increment the _#

Here is what I am using to delete...
Dim WS As Worksheet
Dim QT As QueryTable
For Each WS In Worksheets
For Each QT In WS.QueryTables
QT.Delete
Next
Next
Dim N As name
For Each N In ActiveWorkbook.Names
N.Delete
Next

My VBA code is set to run each time the book is opened and the option to
re-FTP data was selected. Does the .delete need time to complete? adding a
donothing counter loop to fix?

Open1... Works with no appended _# so my dynamically created formula using
the named range work fine.

Open2... ERROR _1 has been appended.

Open3... Works with nothing appended.

Open4... ERROR _1 again

Each time the only named ranges stored in the WB are the 2 matching the
query tables I have created except the _# being appended or not.

any suggestions?

does closing the workbook do something to complete the named deletes?

Grabbing for straws here!

TIA
--
Regards,
John

 
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
How to Delete blanks between a range and populate only the names inthe given range Yuvraj Excel Discussion (Misc queries) 2 November 4th 09 08:32 PM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
Create/copy combo boxes in one range if condition is met in a different range LB[_4_] Excel Programming 4 September 30th 05 12:21 AM
Can I create a macro to identify and delete blank rows in a range? carlsondj Excel Programming 6 June 10th 05 12:38 AM
Range.Delete and Range.Resize.Name performance issues Test.File Excel Programming 0 February 15th 05 03:33 PM


All times are GMT +1. The time now is 06:45 AM.

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"