ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   [QueryTables] showing results on a per row basis (https://www.excelbanter.com/excel-programming/375563-%5Bquerytables%5D-showing-results-per-row-basis.html)

Giupo

[QueryTables] showing results on a per row basis
 
Hi all,

I wish I could show a result of a query on a per row basis, is there a
way I could do that?
My code:
Dim rg as Range
Dim dest as Range
....
Do Until IsEmpty(rg)
stSQL = "SELECT value AS " & rg.Value & " FROM table where
obj='" & rg.value & "';"
Set qData = wsSheet.QueryTables.Add(Connection:=stODBC,
Destination:=dest, Sql:=stSQL)
qData.Refresh BackgroundQuery:=False
Set rg = rg.Offset(1, 0)
Set dest = dest.Offset(1, 0)
Loop


the rg variable containes the names for the sql where condition, and
dest is the destination range passed to the querytables.
Actually the result is showed on a per column basis, shiftin down one
cell each query (which is not really what I wanted to do 8-B).

Thank you,
Giuseppe



All times are GMT +1. The time now is 06:45 PM.

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