Copy rows to total page
Solved/Closed
Tom
-
12 Feb 2010 à 10:52
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 12 Feb 2010 à 15:51
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 12 Feb 2010 à 15:51
Related:
- Copy rows to total page
- Total copy - Download - File management
- Total video player - Download - Video playback
- Total video converter - Download - Video converters
- Total war warhammer 3 free download - Download - Strategy
- Total uninstall - Download - Cleaning and optimization
1 response
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
12 Feb 2010 à 12:02
12 Feb 2010 à 12:02
With macro it can be done. But why have 13 sheets ? why not have one sheet from the start where you enter all your transactions, have a column there for month (if not already there) and then if you want to see some monthly transaction, just filter on that month ?
12 Feb 2010 à 12:19
Different people will get the monthly forms that have the titles January, February, etc... and the manager gets the total page.
12 Feb 2010 à 15:51
Assumptions.
1. The sheets are names Jan, Feb, ....
2. The Master sheet is called Master
3. The column 1 does not have blank value (it is used to find the max number of rows)
4. There are no more than 11 columns
5. Master sheet already have header row.
Sub copyData() Dim maxRows As Long Dim maxCols As Integer Dim conSheet As String 'consolidated sheet name Dim lConRow As Long Dim maxRowCol As Integer 'used to find max number of rows maxCols = 11 months = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") maxRowCol = 1 conSheet = "Master" Sheets(conSheet).Select Range("A2").Select Cells(65536, 256).Select Selection.End(xlDown).Select maxRows = Selection.Row Range("A2", Selection).Select Selection.ClearContents lConRow = 2 For x = 0 To Sheets.Count - 2 Sheets(months(x)).Select If ActiveSheet.AutoFilterMode Then Cells.Select Selection.AutoFilter End If Cells.Select Dim lastRow As Long lastRow = Cells(maxRows, maxRowCol).End(xlUp).Row If (lastRow > 1) Then Range(Cells(2, 1), Cells(lastRow, maxCols)).Select Selection.Copy Sheets(conSheet).Select Cells(lConRow, 1).Select Selection.PasteSpecial lConRow = Cells(maxRows, maxRowCol).End(xlUp).Row lConRow = lSummaryRow + 1 End If If ActiveSheet.Name = "Dec" Then Exit Sub Next End Sub