Hi All
I am trying to create a summary sheet based on the total of various sheets in a workbook.
Eg: Sheet 1 the word total will appear in A400 Corresponding with A400 will be amounts totaled per ageing list
Sheet 2 the word total will appear in A74 Corresponding with A74 will be amounts totaled per ageing list
The names of the sheets differ. I have found some code that works partially, however it has specific cell referencing which means that it copies random information from the sheets. I want it to create a new sheet, in A it must copy the source sheet name, in B it must copy the total ageing for that sheet.
The row of the data will change however the columns remain fixed The ageing appears from column G:L
The macro must find the word "Total" in column A and copy the corresponding cells G:L to the summary sheet into columns C:H
Dim Sh As Worksheet
Dim Newsh As Worksheet
Dim myCell As Range
Dim ColNum As Integer
Dim RwNum As Long
Dim Basebook As Workbook
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
'Delete the sheet "Summary-Sheet" if it exist
Application.DisplayAlerts = False
On Error Resume Next
ActiveWorkbook.Worksheets("Summary-Sheet").Delete
On Error GoTo 0
Application.DisplayAlerts = True
'Add a worksheet with the name "Summary-Sheet"
Set Basebook = ActiveWorkbook
Set Newsh = Basebook.Worksheets.Add
Newsh.Name = "Summary-Sheet"
'The links to the first sheet will start in row 2
RwNum = 1
For Each Sh In Basebook.Worksheets
If Sh.Name <> Newsh.Name And Sh.Visible Then
ColNum = 1
RwNum = RwNum + 1
'Copy the sheet name in the A column
Newsh.Cells(RwNum, 1).Value = Sh.Name
For Each myCell In Sh.Range("A67,G67:L67") '<--Change the range
ColNum = ColNum + 1
Newsh.Cells(RwNum, ColNum).Formula = _
"='" & Sh.Name & "'!" & myCell.Address(False, False)
Next myCell
End If
Next Sh
Newsh.UsedRange.Columns.AutoFit
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
Display More