Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
simora
 
Posts: n/a
Default copy ranges from multiple worksheets


I have a workbook # 511 with 7 sheets. I want to copy the first 6
sheets to sheet 7 from these specific ranges.


sheets("Sheet1").Select
Range("A5:Q58")

Sheets("Sheet 2").Select
Range("A5:Q58")

Sheets("Sheet 3 ").Select
Range("A5:Q38")

Sheets("Sheet 4 ").Select
Range("A5:Q25")

Sheets("Sheet 5 ").Select
Range("A5:Q35")

Sheets("Sheet 6 ").Select
Range("A5:Q25")


3 questions;

Exactly how do I do this so that changes made to any sheet is also
reflected on Sheet 7 (TOTALS_PAGE)

How can I make the current column D for instance in the 6 workbooks be
based on a past workbook from last weeks's cloumn P ( NOT d ) for
instance.


Each workbook is named with a number based on the last number used.
This is 511 last week was 510 etc. How do I have either VBA or a
macro automatically look and use that number to find the last
workbook. Cell C 1 always contain the name/number of the current
workbook on each worksheet.

  #2   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi

What do you want to do with returned data? I.e. do you want to display data
from Sheet1 p.e. in range A5:Q58, data from Sheet2 in range A59:Q116, etc.?
Or do yo want to calculate sum or count or average of values p.e. cells A5
from 6 sheet, etc.

To simply return a value from another sheet, you can use link. P.e.
=Sheet1!A5
rerturns the value from cell A5 on sheet Sheet1. To avoid empty cells
returned as 0's, you can modify this formula slightly:
=IF(Sheet1!A5="","",Sheet1!A5)
(Combining absolute and relative references - Sheet1!A5; Sheet1!$A5;
Sheet1!A$5; Sheet1!$A$5 - you can control how cell references in link
formula will behave when the formula is copied to some range)


When yo want to return some aggregate value, based on values on all 6 sheet,
you can include links in aggregate functions. P.e.
=SUM(Sheet1!A5,Sheet2!A5,Sheet3!A5,Sheet4!A5,Sheet 5!A5,Sheet6!A5)
or
=IF(SUM(Sheet1!A5,Sheet2!A5,Sheet3!A5,Sheet4!A5,Sh eet5!A5,Sheet6!A5)=0,"",SU
M(Sheet1!A5,Sheet2!A5,Sheet3!A5,Sheet4!A5,Sheet5!A 5,Sheet6!A5))
does return the sum of values in cell A5 on sheets Sheet1...Sheet6.
There is a way to shorten the formulas above:
=SUM(Sheet1:Sheet6!A5)
or
=IF(SUM(Sheet1:Sheet6!A5)=0,"",SUM(Sheet1:Sheet6!A 5))
, but you have then to ensure, that no sheet except ones you want to sum is
placed between Sheet1 and Sheet6, and that no sheet you want to sum is moved
outside from sheet range marked with Sheet1 and Sheet6.

--
When sending mail, use address arvil<attarkon.ee
Arvi Laanemets


"simora" wrote in message
...

I have a workbook # 511 with 7 sheets. I want to copy the first 6
sheets to sheet 7 from these specific ranges.


sheets("Sheet1").Select
Range("A5:Q58")

Sheets("Sheet 2").Select
Range("A5:Q58")

Sheets("Sheet 3 ").Select
Range("A5:Q38")

Sheets("Sheet 4 ").Select
Range("A5:Q25")

Sheets("Sheet 5 ").Select
Range("A5:Q35")

Sheets("Sheet 6 ").Select
Range("A5:Q25")


3 questions;

Exactly how do I do this so that changes made to any sheet is also
reflected on Sheet 7 (TOTALS_PAGE)

How can I make the current column D for instance in the 6 workbooks be
based on a past workbook from last weeks's cloumn P ( NOT d ) for
instance.


Each workbook is named with a number based on the last number used.
This is 511 last week was 510 etc. How do I have either VBA or a
macro automatically look and use that number to find the last
workbook. Cell C 1 always contain the name/number of the current
workbook on each worksheet.



  #3   Report Post  
simora
 
Posts: n/a
Default



Arvi Laanemets wrote:
Hi

What do you want to do with returned data? I.e. do you want to display data
from Sheet1 p.e. in range A5:Q58, data from Sheet2 in range A59:Q116, etc.?
Or do yo want to calculate sum or count or average of values p.e. cells A5
from 6 sheet, etc.


*** I just want to copy the data and retain the links, so that changes
made in any of the original sheet will be reflected on the last sheet.



To simply return a value from another sheet, you can use link. P.e.
=Sheet1!A5
rerturns the value from cell A5 on sheet Sheet1. To avoid empty cells
returned as 0's, you can modify this formula slightly:
=IF(Sheet1!A5="","",Sheet1!A5)
(Combining absolute and relative references - Sheet1!A5; Sheet1!$A5;
Sheet1!A$5; Sheet1!$A$5 - you can control how cell references in link
formula will behave when the formula is copied to some range)

You lost me somewhere in there. I think I simply need a copy &
pastelink that goes out to those shetts and selects those rows and does
the copying, then pastes them on the final sheet.

When yo want to return some aggregate value, based on values on all 6 sheet,
you can include links in aggregate functions. P.e.
=SUM(Sheet1!A5,Sheet2!A5,Sheet3!A5,Sheet4!A5,Sheet 5!A5,Sheet6!A5)
or
=IF(SUM(Sheet1!A5,Sheet2!A5,Sheet3!A5,Sheet4!A5,Sh eet5!A5,Sheet6!A5)=0,"",SU
M(Sheet1!A5,Sheet2!A5,Sheet3!A5,Sheet4!A5,Sheet5!A 5,Sheet6!A5))
does return the sum of values in cell A5 on sheets Sheet1...Sheet6.
There is a way to shorten the formulas above:
=SUM(Sheet1:Sheet6!A5)
or
=IF(SUM(Sheet1:Sheet6!A5)=0,"",SUM(Sheet1:Sheet6!A 5))
, but you have then to ensure, that no sheet except ones you want to sum is
placed between Sheet1 and Sheet6, and that no sheet you want to sum is moved
outside from sheet range marked with Sheet1 and Sheet6.

No other sheets will be inserted or moved.

.................
How can I make the current column D for instance in the 6 workbooks be
based on a past workbook from last weeks's cloumn P ( NOT d ) for
instance.

Each workbook is named with a number based on the last number used.
This is 511 last week was 510 etc. How do I have either VBA or a
macro automatically look and use that number to find the last
workbook. Cell C 1 always contain the name/number of the current
workbook on each worksheet.


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
Copy & paste in multiple areas using VBA Rob Excel Discussion (Misc queries) 12 April 11th 05 02:09 PM
CREATE MACRO TO COPY MULTIPLE WORKSHEETS Bewilderd jim Excel Discussion (Misc queries) 5 March 3rd 05 10:00 PM
compare unique identifiers in multiple ranges bawilli_91125 Charts and Charting in Excel 1 November 30th 04 06:34 PM
Named dynamic ranges, copied worksheets and graph source data WP Charts and Charting in Excel 1 November 28th 04 05:19 PM
copy pivot table to multiple worksheets Todd Excel Worksheet Functions 2 November 19th 04 03:16 AM


All times are GMT +1. The time now is 11:54 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"