ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Summarizeing sheets (https://www.excelbanter.com/excel-programming/301138-summarizeing-sheets.html)

Johnny[_7_]

Summarizeing sheets
 
What I am trying to do is to summarize all sheets in the workbook onto
a "summary" tab
This summary should have the format of:
On Summary Sheet
<B1Sheet a's Name
<B2Sheet a's First Row
<B3Sheet b's Name
<B4Sheet b's First Row
I am not great at vb style programming. Here is the pseudo style
code. Any help makeing this code to become working is appreciated.
This is for Excel 97.
Sub CreateSummaryOfWorkbooks()
Dim wsName As String
X = 1
For Each Sheet In Sheets
Sheet.Select
wsName = Worksheet.Name ' problem setting name into string
Cells(A, 1).Select
Selection.EntireRow.Copy
Worksheets("Summary").Select
Cells(B, X) = wsName
Cells(B, X + 1).Paste
X = X + 2
Next
End Sub

Thanks

Frank Kabel

Summarizeing sheets
 
Hi
not tested but try
Sub CreateSummaryOfWorkbooks()
Dim wsName As String
Dim wks as worksheet
Dim target_sheet as worksheet
Dim X

set target_sheet=Worksheets("Summary")
X = 1
For Each wks In worksheets
wsName = wks.name
if lcase(wksname)<"summary" then
target_wks.Cells(X,"B").value = wsName
target_wks.cells(X+1,"B").value=wks.cells(1,"A").v alue
X = X + 2
end if
Next
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


Johnny wrote:
What I am trying to do is to summarize all sheets in the workbook

onto
a "summary" tab
This summary should have the format of:
On Summary Sheet
<B1Sheet a's Name
<B2Sheet a's First Row
<B3Sheet b's Name
<B4Sheet b's First Row
I am not great at vb style programming. Here is the pseudo style
code. Any help makeing this code to become working is appreciated.
This is for Excel 97.
Sub CreateSummaryOfWorkbooks()
Dim wsName As String
X = 1
For Each Sheet In Sheets
Sheet.Select
wsName = Worksheet.Name ' problem setting name into string
Cells(A, 1).Select
Selection.EntireRow.Copy
Worksheets("Summary").Select
Cells(B, X) = wsName
Cells(B, X + 1).Paste
X = X + 2
Next
End Sub

Thanks




All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com