Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Selects
Hi All,
This is probably a easy question to answer and I have tried a few things but with no luck. I am using a connection to a database to get some data out of it and display it in Excel, the code looks some thing like :- Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=XXX;UID=XXX;pword=XXXAPP=Microsoft® Query;WSID=XXX;DATABASE=XXXX;Network=DBMSSOCN;Trus ted_Connection=Yes" _ , Destination:=Range("A1")) .CommandText = Array("select * from TABLE") Debug.Print .CommandText .Name = "Sheet1" This code just places the return results in Sheet1 starting from Cell's A1, what I would like to do is in the same module call a second select statement and place the results in the same sheet but starting from D1, I have tried a few things but I can only get the first select's worth of data to show and nothing else. If anyone could help that would be great. Thanks Phil |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Selects
Hi Phil,
I may be missing something but would you merely need to change Destination:=Range("A1")) to Destination:=Range("D1"))? Andi "Phil" wrote in message ... Hi All, This is probably a easy question to answer and I have tried a few things but with no luck. I am using a connection to a database to get some data out of it and display it in Excel, the code looks some thing like :- Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=XXX;UID=XXX;pword=XXXAPP=Microsoft® Query;WSID=XXX;DATABASE=XXXX;Network=DBMSSOCN;Trus ted_Connection=Yes" _ , Destination:=Range("A1")) .CommandText = Array("select * from TABLE") Debug.Print .CommandText .Name = "Sheet1" This code just places the return results in Sheet1 starting from Cell's A1, what I would like to do is in the same module call a second select statement and place the results in the same sheet but starting from D1, I have tried a few things but I can only get the first select's worth of data to show and nothing else. If anyone could help that would be great. Thanks Phil |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Selects
Hi Andi
Thanks for the reply, what I mean is I want to run both of the select statments from the same macro, so that I have the data from select (1) in column A1 and the data from the select (2) in D1, sorry I should of explained better, my fault. Thanks again, Philip "Andibevan" wrote: Hi Phil, I may be missing something but would you merely need to change Destination:=Range("A1")) to Destination:=Range("D1"))? Andi "Phil" wrote in message ... Hi All, This is probably a easy question to answer and I have tried a few things but with no luck. I am using a connection to a database to get some data out of it and display it in Excel, the code looks some thing like :- Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=XXX;UID=XXX;pword=XXXAPP=Microsoft® Query;WSID=XXX;DATABASE=XXXX;Network=DBMSSOCN;Trus ted_Connection=Yes" _ , Destination:=Range("A1")) .CommandText = Array("select * from TABLE") Debug.Print .CommandText .Name = "Sheet1" This code just places the return results in Sheet1 starting from Cell's A1, what I would like to do is in the same module call a second select statement and place the results in the same sheet but starting from D1, I have tried a few things but I can only get the first select's worth of data to show and nothing else. If anyone could help that would be great. Thanks Phil |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Single click selects multiple cells | Excel Discussion (Misc queries) | |||
Excel clicking selects multiple cells instead of a single cell | Excel Discussion (Misc queries) | |||
Mouse selects only multiple cells | Excel Discussion (Misc queries) | |||
excel 2007 click selects multiple cells | Setting up and Configuration of Excel | |||
help fix - - one click now selects multiple cells in Excel 2007 | Excel Discussion (Misc queries) |