Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have some data on a worksheet. I would like to use this data as input into a SQL query (Select .... from Sheet1....group by....) and load the query output on a different worksheet. How can I set up a Excel VBA macro with a SQL that will allow me to do this? -- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() It seem like you know SQL pretty well. You have afew choices. Depending on the number of items you are returning your can setup a SQL with multiple WHERE clauses to return all the items at one time or retrieve the data multiple times with a single WBERE clause. there arre two questions that need to be answered 1) Do you wnat to have the query automatically update? 2) Are the number of rows that are going to be returned each time the data is retrieve the same number of rows or are the number of rows returned going to be different each time the data is retrieved? You can get data from a database using a query or opening the database as a recordset like you would in Access. The recordset commands in Excel VBA and Access VBA are the same as is probably the better method is the number of rows going to be different each time the query is run. the disadvantage with the recordset is you would have to manually run the update or setup a timer to run the macro periodically. You can alos use a workbook open event to retrieve the data as another option. I think you need to think about which options you want before you ask for the correct code to impliment the options you choose. -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=153331 Microsoft Office Help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculation Context available inside an Excel VBA function? | Excel Programming | |||
Using a range variable inside a excel function | Excel Discussion (Misc queries) | |||
Selectig rows inside a group | Excel Programming | |||
How do I group worksheets (Lotus 123 function is "Sheet>Group Shee | Excel Worksheet Functions | |||
How do i group worksheets inside a workbook into subgroups? | Excel Worksheet Functions |