Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Single click selects multiple cells Mike1558 Excel Discussion (Misc queries) 7 May 27th 10 05:34 PM
Excel clicking selects multiple cells instead of a single cell texmaam Excel Discussion (Misc queries) 2 March 11th 10 05:19 PM
Mouse selects only multiple cells Jo Excel Discussion (Misc queries) 8 June 30th 09 08:17 PM
excel 2007 click selects multiple cells marathon-man Setting up and Configuration of Excel 4 October 10th 08 12:15 AM
help fix - - one click now selects multiple cells in Excel 2007 R James Excel Discussion (Misc queries) 5 October 8th 07 04:16 PM


All times are GMT +1. The time now is 08:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"