Hello,

it now seems that I might be able to use SQL/MS Query to do what I tried to find a workaround. (Even if this works that does not invalidate the problem posed in that thread, though its urgency would be reduced.)

So: is there a way to perform in a macro SQL queries on data coming from the same workbook?

Say, take the data from several different ranges as if they were SQL tables, perform some SQL queries (like GROUP BY, SORT BY etc.) and return the result in a chart, all from and to the same datasheet!

I tried to open a connection from an Excel file to itself as if it were an external database, only to be told by the Wizard that it does not contain any tables. And I don't know whether this is a problem within the Excel file or due to it trying to connect to itself.

Thanks a lot!

P.S. I should add that I have never worked with MS Query or any other way used SQL in Excel.

Recommended Answers

All 2 Replies

I tried to open a connection from an Excel file to itself as if it were an external database, only to be told by the Wizard that it does not contain any tables. And I don't know whether this is a problem within the Excel file or due to it trying to connect to itself.

No way to really help you. At least I can't help you.

Please post the code you used to connect to the Excel File. And please post your Sequel Statement. We may have experience in making connections and using SQL statements. But not too many of us here are warlocks or witches or have a direct connection with God that allows us access to the private information within the inner recesses of your brain.

I don't think I was this fuzzy that you'd need God or any other god to get my saying.

What I want to do is take some range (let's say "A3:C5;BH3:BL5" to make it a minor challenge) which would make this a range collection, an perform a simple SQL query (which one is of no importance but let's say SELECT * FROM [range collection] ) to either return it to a range or a chart or do whatever would please me or you or any other DaniWeb user.

To connect to my Excel sheet I used the Wizard so I really can't give you any code as that would be part of the answer I'm looking for. Thank you very much!

You may have experience with connections and SQL statement - as far as SQL is concerned I do too. I don't need help with SQL but with the basic question: is it possible at all or if then how.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.