Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default How to combine amount in manys sheets into 1 summary sheets

Hello,

Thi is my worksheets which are identical in column header but not in the
number of rows an names. I want to combine the calculation of the employee
income tax.

This is my worsheet layout approximately

1. Name. Tx ID Gross salary Tax net Salary
--------- ------- -------------- ------- -----------
Mr A 253 25,000 5000 20,000
Mr. B
and so forth

in sheet Jan could only be 50 labors and and in sheet Feb could be 40 labors
while
in Mar could rise up to 60.

I appreciate if someone can help me how can I combine the 12 sheets in front
for summary sheets ( Total).

Thanks,

Frank
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to combine amount in manys sheets into 1 summary sheets

Try this code. It creates a summary sheet called "Summary" and assumes the
sheet names are abbreviated months Jan, Feb, Mar. The code uses the function
monthnames to get the abbrieviate months. You can change the TRUE to False
to get the non-abbreviated names. the code also sorts the summary sheet by
the Tax ID column B.

Sub combinetaxes()

'check if summary sheet exists
found = False
For Each Sht In Sheets
If Sht.Name = "Summary" Then
found = True
End If
Next Sht

If found = False Then
Sheets.Add befo=Sheets(1)
ActiveSheet.Name = "Summary"
End If

Set SumSht = Sheets("Summary")

With SumSht
For MyMonth = 1 To 12
MName = MonthName(MyMonth, abbreviate:=True)
Set Sht = Sheets(MName)
If MyMonth = 1 Then
'copy header row only once
Sht.Rows(1).Copy Destination:=SumSht.Rows(1)
End If

SourceLastRow = Sht.Range("A" & Rows.Count).End(xlUp).Row
SumLastRow = .Range("A" & Rows.Count).End(xlUp).Row
SumNewRow = SumLastRow + 1
'copy rows skipping header rows
Sht.Rows("2:" & SourceLastRow).Copy _
Destination:=SumSht.Rows(SumNewRow)

'sort Sumary sheet by Tax ID column B
SumLastRow = .Range("B" & Rows.Count).End(xlUp).Row
.Rows("1:" & SumLastRow).Sort _
header:=xlYes, _
key1:=.Range("B1"), _
order1:=xlAscending
Next MyMonth
End With

End Sub


"Frank Situmorang" wrote:

Hello,

Thi is my worksheets which are identical in column header but not in the
number of rows an names. I want to combine the calculation of the employee
income tax.

This is my worsheet layout approximately

1. Name. Tx ID Gross salary Tax net Salary
--------- ------- -------------- ------- -----------
Mr A 253 25,000 5000 20,000
Mr. B
and so forth

in sheet Jan could only be 50 labors and and in sheet Feb could be 40 labors
while
in Mar could rise up to 60.

I appreciate if someone can help me how can I combine the 12 sheets in front
for summary sheets ( Total).

Thanks,

Frank

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default How to combine amount in manys sheets into 1 summary sheets

Thanks Joel, I will try it

Frank

"Joel" wrote:

Try this code. It creates a summary sheet called "Summary" and assumes the
sheet names are abbreviated months Jan, Feb, Mar. The code uses the function
monthnames to get the abbrieviate months. You can change the TRUE to False
to get the non-abbreviated names. the code also sorts the summary sheet by
the Tax ID column B.

Sub combinetaxes()

'check if summary sheet exists
found = False
For Each Sht In Sheets
If Sht.Name = "Summary" Then
found = True
End If
Next Sht

If found = False Then
Sheets.Add befo=Sheets(1)
ActiveSheet.Name = "Summary"
End If

Set SumSht = Sheets("Summary")

With SumSht
For MyMonth = 1 To 12
MName = MonthName(MyMonth, abbreviate:=True)
Set Sht = Sheets(MName)
If MyMonth = 1 Then
'copy header row only once
Sht.Rows(1).Copy Destination:=SumSht.Rows(1)
End If

SourceLastRow = Sht.Range("A" & Rows.Count).End(xlUp).Row
SumLastRow = .Range("A" & Rows.Count).End(xlUp).Row
SumNewRow = SumLastRow + 1
'copy rows skipping header rows
Sht.Rows("2:" & SourceLastRow).Copy _
Destination:=SumSht.Rows(SumNewRow)

'sort Sumary sheet by Tax ID column B
SumLastRow = .Range("B" & Rows.Count).End(xlUp).Row
.Rows("1:" & SumLastRow).Sort _
header:=xlYes, _
key1:=.Range("B1"), _
order1:=xlAscending
Next MyMonth
End With

End Sub


"Frank Situmorang" wrote:

Hello,

Thi is my worksheets which are identical in column header but not in the
number of rows an names. I want to combine the calculation of the employee
income tax.

This is my worsheet layout approximately

1. Name. Tx ID Gross salary Tax net Salary
--------- ------- -------------- ------- -----------
Mr A 253 25,000 5000 20,000
Mr. B
and so forth

in sheet Jan could only be 50 labors and and in sheet Feb could be 40 labors
while
in Mar could rise up to 60.

I appreciate if someone can help me how can I combine the 12 sheets in front
for summary sheets ( Total).

Thanks,

Frank

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
Summary from multiple sheets Sudhir Excel Discussion (Misc queries) 1 June 3rd 10 11:40 AM
Summary of multiple sheets Melo Excel Worksheet Functions 1 July 17th 07 09:06 PM
Combine cell totals from 5 sheets into summary in Excel milor Excel Discussion (Misc queries) 1 June 18th 05 12:42 PM
Summary of data from 20 sheets Allan Skyner Excel Discussion (Misc queries) 7 February 1st 05 04:13 PM


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