Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
optimus_1973
 
Posts: n/a
Default Copy variable ranges fron difernte shets

Hi:

I have multiple workbook (at least 1 max 4) with a database which varies in
the number of registers (in some cases are 250 in others 450) and i want to:

- Select the range in workbook1 and copy to a consolidate new book then
- Select the range in workbook2 and copy to a consolidate
- Select the range in workbook3 and copy to a consolidate
- Select the range in workbook2 and copy to a consolidate

The previous data must keep.

Can any one helpme with this macro.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default Copy variable ranges fron difernte shets

You might be able to use MS Query to consolidate Excel ranges from your
multiple wkbks/wkshts. This also works for consolidating data from the
active workbook (Just save it first so Excel can find it):

My example uses 5 named ranges in 5 different workbooks.
(Each range contain 4 columns: Dept, PartNum, Desc, Price)

Assumptions:
The data in each wkbk is structured like a table:
---Col headings (Dept, PartNum, Desc, Price)
---Columns are in the same order.

The data in each wkbk must be named ranges.
---I used rng1111Data for dept 1111's data, rng2222Data for dept 2222, etc
---You may use the same range name in different wkbks.

(Note: MS Query may display warnings about it's ability to show the query
....ignore them and proceed.)

Starting with an empty worksheet:
1)Select the cell where you want the consolidated data to start

2)DataImport External DataNew Database Query
Databases: Excel Files


Browse to one of The files, pick The data range to import.
---Accept defaults until the next step.

At The last screen select The View data/Edit The Query option.

Click the [SQL] button

Replace the displayed SQL code with an adapted version of this:

SELECT * FROM `C:\Inventories\Dept1111`.rng1111Data
union all
SELECT * FROM `C:\Inventories\Dept2222`.rng2222Data
union all
SELECT * FROM `C:\Inventories\Dept3333`.rng3333Data
union all
SELECT * FROM `C:\Inventories\Dept5555`.rng4444Data
union all
SELECT * FROM `C:\Inventories\Dept5555`.rng5555Data

Return the data to Excel.

Once that is done....to get the latest data just click in the data range
then DataRefresh Data.

You can edit the query at any time to add/remove data sources and/or fields.

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"optimus_1973" wrote:

Hi:

I have multiple workbook (at least 1 max 4) with a database which varies in
the number of registers (in some cases are 250 in others 450) and i want to:

- Select the range in workbook1 and copy to a consolidate new book then
- Select the range in workbook2 and copy to a consolidate
- Select the range in workbook3 and copy to a consolidate
- Select the range in workbook2 and copy to a consolidate

The previous data must keep.

Can any one helpme with this macro.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
optimus_1973
 
Posts: n/a
Default Copy variable ranges fron difernte shets

Thanks Ron i go to do it and i tell you about.

Optimus_1973

*-*-*-*-*-*-*-*

"Ron Coderre" wrote:

You might be able to use MS Query to consolidate Excel ranges from your
multiple wkbks/wkshts. This also works for consolidating data from the
active workbook (Just save it first so Excel can find it):

My example uses 5 named ranges in 5 different workbooks.
(Each range contain 4 columns: Dept, PartNum, Desc, Price)

Assumptions:
The data in each wkbk is structured like a table:
---Col headings (Dept, PartNum, Desc, Price)
---Columns are in the same order.

The data in each wkbk must be named ranges.
---I used rng1111Data for dept 1111's data, rng2222Data for dept 2222, etc
---You may use the same range name in different wkbks.

(Note: MS Query may display warnings about it's ability to show the query
...ignore them and proceed.)

Starting with an empty worksheet:
1)Select the cell where you want the consolidated data to start

2)DataImport External DataNew Database Query
Databases: Excel Files


Browse to one of The files, pick The data range to import.
---Accept defaults until the next step.

At The last screen select The View data/Edit The Query option.

Click the [SQL] button

Replace the displayed SQL code with an adapted version of this:

SELECT * FROM `C:\Inventories\Dept1111`.rng1111Data
union all
SELECT * FROM `C:\Inventories\Dept2222`.rng2222Data
union all
SELECT * FROM `C:\Inventories\Dept3333`.rng3333Data
union all
SELECT * FROM `C:\Inventories\Dept5555`.rng4444Data
union all
SELECT * FROM `C:\Inventories\Dept5555`.rng5555Data

Return the data to Excel.

Once that is done....to get the latest data just click in the data range
then DataRefresh Data.

You can edit the query at any time to add/remove data sources and/or fields.

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"optimus_1973" wrote:

Hi:

I have multiple workbook (at least 1 max 4) with a database which varies in
the number of registers (in some cases are 250 in others 450) and i want to:

- Select the range in workbook1 and copy to a consolidate new book then
- Select the range in workbook2 and copy to a consolidate
- Select the range in workbook3 and copy to a consolidate
- Select the range in workbook2 and copy to a consolidate

The previous data must keep.

Can any one helpme with this macro.

Thanks

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
How do I copy formula but only increment certain ranges? Martc Excel Discussion (Misc queries) 8 February 4th 10 11:01 PM
Variable ranges John Contact Excel Worksheet Functions 1 June 17th 05 08:02 AM
copy ranges from multiple worksheets simora Excel Worksheet Functions 2 May 18th 05 01:42 AM
Sum Variable Ranges Erika Excel Worksheet Functions 6 December 23rd 04 03:52 PM
Variable Print Ranges Zshepherd Excel Discussion (Misc queries) 0 December 2nd 04 03:23 PM


All times are GMT +1. The time now is 01:19 AM.

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"