Is there a way to replace the SQL command text in the data connection in Excel via VBA?
For example, I have a data connection named "Accounts" and it has a simple query in the command text that states
Select a.*
from Recon a
where a.recon in
('12345','67890')
I have the SQL statement built in a sheet1 (cell A2 through cell A5) that allows users to enter different "recon" numbers. Instead of them having to copy and paste this into the command text in the data connection. I want to be able to have a macro that copies and paste the SQL from cell A2 through cell A5 into the command text in the data connection and then refresh the data connection which is connected to Table1.