+ Reply to Thread
Results 1 to 2 of 2

Combining data from 2 worksheets into a single data source

  1. #1
    Registered User
    Join Date
    08-31-2003
    Location
    Seattle
    Posts
    5

    Combining data from 2 worksheets into a single data source

    I frequently import data from an Oracle database into Excel so I can work with the data locally without being connected to the Oracle database. My process is to script a query against the Oracle db in a macro and dump the results into a worksheet. Once that is done I can then query the data in Excel using the following code:

    Please Login or Register  to view this content.
    Specifying a workbook Name allows me to query the data with sql statements just like any other ODBC database. However I've run into an Oracle table that contains more than 65534 rows so when I dump it into my workbook I have to split it across two worksheets. The problem I'm having is with trying to combine data from the two worksheets into a single Workbook.Name that I can run queries against. Is there a way to define a Workbook.Name that straddles two worksheets? If not, is there some other way around the problem? To summarize, I want to combine data from two worksheets into a single data source that I can query using common sql language.

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    There is no need to create a named range.

    You can query 2 or more worksheets with one SQL statement by using the UNION command,
    Please Login or Register  to view this content.
    Change the worksheet names as required and note the dollar symbol after each name.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1