adodb query excel spreadsheet, query return sheet row?

RAYLWARD102

Well-known Member
Joined
May 27, 2010
Messages
529
Experimenting with queries to my worksheet. So far, I can successfully get meaningful results back, but wonder how I can get those results to include the row they were found in??

My query Looks something like "SELECT [test1], [test2] FROM [Sheet1$]"
Want query to get row some how in results "SELECT ROW() as MyRow, [test1], [test2] FROM [Sheet1$]"

Obviously ROW() in my query doesn't work. I dont really want to add a row() formula to a cell in a column either; just thought there should be a way to return the row as a value in my adodb recordset. Any idea's?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
The reason why I'd like to have the row number return in the recordset as a value, is because I need to format the specific row, in Sheet1, in excel, afterwards; by format I mean change the color and other fancy stuff that you'd never accomplish via adodb.

oh!! and the above queries will be more something like "SELECT [test1], [test2] FROM [Sheet1$] WHERE [test1] = "MrExcel"
The query will be applied against a sheed named Sheet1 with named ranges test1, test2. The sheet has about 5000 rows of data. My Query will likley return 2-3 rows and need to know the rows as a value in my query, as mentioned earlier.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,883
Messages
6,175,167
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top