TransferSpreadsheet gives different behavior

P

Phil Smith

I started with 12 queries, and a macro to use TransferSpreadsheet into
an Excel spreadsheet called SalesD.xls into pre-existing preformated
worksheet tabs called: sales1-d, sales2-d, sales3-d etc. These are also
the names of the queries.
I run that macro, it works. I run it 10 times, it still works. I get
the existing tabs filled with the correct data, formatting intact.
Now I need the same thing again but with a couple key changes to the
selection criteria, so I:
1) Opened, edited for criteria, and saved each query as
Sales1-w, Sales2-w, etc.
2) I copied the macro and edited it to transferSpreadsheet Sales1-w
instead of Sales1-d, etc. and changed the filename to transfer in to
SalesW.xls.
3) Copied SalesD.xls to SalesW.xls, end renamed all of the formatted
tabs from Sales1-d to Sales1-w, etc. all once again matching the Query
names.

PROBLEM:
When I run THIS Macro, While there is a tab called Sales1-w, and there
is a worksheet tab in that spreadsheet called Sales1-w, it instead
creates a new tab called Sales1-w1, and on with all twelve queries.
I run it several times, and it contiues to put the data into Sales1-w1,
etc. instead of the queries it should.

What's up with that?
If I kill the spreadsheet and run the macro, it creates it with the
correct tabs, and I can run it several times and will still work with
the correct tabs.

Help?
 

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

Top