renaming a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I had to change the SQL on an existing query, but the columns came back in
the wrong sequence. So then I deleted the query range (got the warning I was
detelting a query) and built the new query table.

Now too match up with my VBA I want to rename the query table
"ExternalData_1". I receive the message : "A query with this name already
exists on this sheet". Yet when I loop through all the sheets/queryTables. I
do not see the "ExternalData_1" table listed. How do I get Excel to allow me
to rename my new ExternalData_1 query?
 
Run this code

Sub MakeNamesvisible()
Dim nme as Name
for each nme in ActiveWorkbook.Names
nme.Visible = True
Next
End sub

Now look at the names collection and you will see there is a defined name
related to each query table. I suspect the "already exists" name is found
there still as well. Perhaps deleting it will allow you to rename your
query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top