Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Macro to cycle through worksheets

I want to create a button activated macro to pull the worksheet name from all
the worksheets in a workbook and summarize them into the final worksheet with
associated functions to perform on the worksheet data. I want the macro to
cycle through any worksheets the workbook may contain and on the summary
sheet caculate data from the worksheet. Caveat - I won't know the names of
most of the worksheets before creating the macro.

For example:
The workbook contains Sheet1, Sheet2, and Sheet3. On sheet 3, I want to
place summary data for Sheet1 and Sheet2 as individual rows. In Sheet3!A2 - I
want to place the name of one of the worksheets (e.g., Sheet1), in cell
Sheet3!B2 - calculate the sum of a cell range from the same worksheet
(Sheet1!L2:L17), followed by another function. Then cycle to the next
worksheet (e.g., Sheet2) adding the same information beginning in Sheet3!A3.

Thanks for any help you can provide.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Macro to cycle through worksheets

Untested:

Sub Summarize()
Dim ws As Worksheet
Worksheets.Add , Worksheets(Worksheets.Count)
For Each ws In Worksheets
If ws.Index < Worksheets.Count Then
With Worksheets(Worksheets.Count)
.Cells(ws.Index + 1, 2) = ws.Name
.Cells(ws.Index + 1, 3) =
WorksheetFunction.Sum(ws.Range("L2:L17"))
End With
End If
Next
End Sub
__________________________________________________ ________________________



"tpmax" wrote in message
...
I want to create a button activated macro to pull the worksheet name from
all
the worksheets in a workbook and summarize them into the final worksheet
with
associated functions to perform on the worksheet data. I want the macro to
cycle through any worksheets the workbook may contain and on the summary
sheet caculate data from the worksheet. Caveat - I won't know the names of
most of the worksheets before creating the macro.

For example:
The workbook contains Sheet1, Sheet2, and Sheet3. On sheet 3, I want to
place summary data for Sheet1 and Sheet2 as individual rows. In
Sheet3!A2 - I
want to place the name of one of the worksheets (e.g., Sheet1), in cell
Sheet3!B2 - calculate the sum of a cell range from the same worksheet
(Sheet1!L2:L17), followed by another function. Then cycle to the next
worksheet (e.g., Sheet2) adding the same information beginning in
Sheet3!A3.

Thanks for any help you can provide.



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
Cycle through worksheets and sum David M C Excel Programming 1 January 23rd 06 06:03 PM
How do I cycle through all of the worksheets DMB Excel Discussion (Misc queries) 1 January 9th 06 12:21 AM
How do I cycle through all of the open worksheets? DMB Excel Discussion (Misc queries) 0 January 8th 06 11:24 PM
Cycle through all worksheets Patrick Simonds Excel Programming 8 December 26th 05 01:46 PM
Cycle thru worksheets in a workbook June Excel Programming 1 July 22nd 04 03:06 PM


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