Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Thys
 
Posts: n/a
Default Reference to worksheets

I have a workbook with 45 worksheets. Each sheet has a row of totals which is
not in the same row number in every sheet. I want to create a 46'th sheet
with a summary of all the others, referring to these totals.

Is there an easy way, or must I do the one by one?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach
 
Posts: n/a
Default Reference to worksheets

Yes, there is an easier way. Put this macro in a standard module and run
it.
This macro will find the last row in each sheet and copy that row (5 columns
as written, starting with Column A)
and will paste the values (not the formulas) into the first empty row in a
sheet named "Summary" starting in Column B. Column A of each pasted row
will get the name of the source sheet. HTH Otto
Sub SummarizeData()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = "Summary" Then GoTo SkipSht
With ws
.Range("A" & Rows.Count).End(xlUp).Resize(, 5).Copy
Sheets("Summary").Range("B" &
Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Sheets("Summary").Range("A" &
Rows.Count).End(xlUp).Offset(1).Value = ws.Name
End With
SkipSht:
Next ws
Application.ScreenUpdating = True
End Sub

"Thys" wrote in message
...
I have a workbook with 45 worksheets. Each sheet has a row of totals which
is
not in the same row number in every sheet. I want to create a 46'th sheet
with a summary of all the others, referring to these totals.

Is there an easy way, or must I do the one by one?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Thys
 
Posts: n/a
Default Reference to worksheets

Thanks Otto I'll try that!

"Otto Moehrbach" wrote:

Yes, there is an easier way. Put this macro in a standard module and run
it.
This macro will find the last row in each sheet and copy that row (5 columns
as written, starting with Column A)
and will paste the values (not the formulas) into the first empty row in a
sheet named "Summary" starting in Column B. Column A of each pasted row
will get the name of the source sheet. HTH Otto
Sub SummarizeData()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = "Summary" Then GoTo SkipSht
With ws
.Range("A" & Rows.Count).End(xlUp).Resize(, 5).Copy
Sheets("Summary").Range("B" &
Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Sheets("Summary").Range("A" &
Rows.Count).End(xlUp).Offset(1).Value = ws.Name
End With
SkipSht:
Next ws
Application.ScreenUpdating = True
End Sub

"Thys" wrote in message
...
I have a workbook with 45 worksheets. Each sheet has a row of totals which
is
not in the same row number in every sheet. I want to create a 46'th sheet
with a summary of all the others, referring to these totals.

Is there an easy way, or must I do the one by one?




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Soefje via OfficeKB.com
 
Posts: n/a
Default Reference to worksheets

This works great to move the last line. What if we need to move the entire
contents of the worksheet to a Summary sheet?

Otto Moehrbach wrote:
Yes, there is an easier way. Put this macro in a standard module and run
it.
This macro will find the last row in each sheet and copy that row (5 columns
as written, starting with Column A)
and will paste the values (not the formulas) into the first empty row in a
sheet named "Summary" starting in Column B. Column A of each pasted row
will get the name of the source sheet. HTH Otto
Sub SummarizeData()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = "Summary" Then GoTo SkipSht
With ws
.Range("A" & Rows.Count).End(xlUp).Resize(, 5).Copy
Sheets("Summary").Range("B" &
Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Sheets("Summary").Range("A" &
Rows.Count).End(xlUp).Offset(1).Value = ws.Name
End With
SkipSht:
Next ws
Application.ScreenUpdating = True
End Sub

I have a workbook with 45 worksheets. Each sheet has a row of totals which
is
not in the same row number in every sheet. I want to create a 46'th sheet
with a summary of all the others, referring to these totals.

Is there an easy way, or must I do the one by one?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200603/1
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 390
Default Reference to worksheets

i want to use this macro
i am using excel2007
where can i find the standard module and how do i run can i have the steps pls

"Thys" wrote:

Thanks Otto I'll try that!

"Otto Moehrbach" wrote:

Yes, there is an easier way. Put this macro in a standard module and run
it.
This macro will find the last row in each sheet and copy that row (5 columns
as written, starting with Column A)
and will paste the values (not the formulas) into the first empty row in a
sheet named "Summary" starting in Column B. Column A of each pasted row
will get the name of the source sheet. HTH Otto
Sub SummarizeData()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = "Summary" Then GoTo SkipSht
With ws
.Range("A" & Rows.Count).End(xlUp).Resize(, 5).Copy
Sheets("Summary").Range("B" &
Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Sheets("Summary").Range("A" &
Rows.Count).End(xlUp).Offset(1).Value = ws.Name
End With
SkipSht:
Next ws
Application.ScreenUpdating = True
End Sub

"Thys" wrote in message
...
I have a workbook with 45 worksheets. Each sheet has a row of totals which
is
not in the same row number in every sheet. I want to create a 46'th sheet
with a summary of all the others, referring to these totals.

Is there an easy way, or must I do the one by one?




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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
VLookup using 2 worksheets, whole column reference ROSIE Excel Worksheet Functions 1 February 22nd 06 12:50 AM
Merge Worksheets Mark Jackson Excel Discussion (Misc queries) 1 June 9th 05 10:39 AM
Merge Worksheets Mark Jackson Excel Worksheet Functions 0 June 8th 05 10:42 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM


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