ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Query database results in a named range (https://www.excelbanter.com/excel-programming/386899-query-database-results-named-range.html)

chuck buchanan

Query database results in a named range
 
Good day.

Worksheet "A" has a working VLOOKUP to a named range in worksheet "B".
However, after adding a query of an MS SQL database to retrieve fresh data,
that VLOOKUP returns "#N/A".

I have placed the query results in another range on worksheet "B" and jumped
through all sorts of hoops to "place" that data in the previosuly named
range, but cannot get past the "#N/A".

Any suggestions are greatly appreciated. Thank you.
--
Chuck Buchanan
Special Projects Coordinator

Datasort

Query database results in a named range
 
Chuck:

Assume you have a named range called "ImporData" and a querytables item 1
(default item number). This will set the named range to the range address of
the querry reslults.

ActiveWorkbook.Names("ImportedData").RefersTo =
ActiveSheet.QueryTables(1).resultrange.name

Good Luck

--
Stewart Rogers
DataSort Software, L.C.




All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com