I am trying to write a macro that queries the SQL database but enters a condition into the query. That condition is a range of values in a column in the spreadsheet.
So, I have "Sheet1", where column A is titled "code" with values from A2 onwards. I want to run a SQL query that says:
SELECT value FROM dbtable WHERE code = 'ValueFromA2'
With the result being populated in cell B2.
I then need to continue that query down through B3, B4, etc. until it's reached the end of the range of values in column A.
Is this possible?