View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Giupo Giupo is offline
external usenet poster
 
Posts: 1
Default [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