[QueryTables] showing results on a per row basis

G

Giupo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top