Copying a row

Closed
texaslavender Posts 1 Registration date Wednesday 12 November 2014 Status Member Last seen 12 November 2014 - 12 Nov 2014 à 15:34
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 13 Nov 2014 à 01:02
I need help please. I have a workbook with several sheets. Each sheet contains similar data with a 'total' row indicating the total number of occurrences for each column (each sheet has different totals). I would like to copy that 'total' row from each sheet into a new sheet so that I can chart a histogram. Each row in each sheet may be located in a different location (i.e. one total line may be on row 132, another may be on row 25, etc.) Anybody have any help or suggestions on how I can do this?

Thank you so much in advance.
Related:

1 response

venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 811
13 Nov 2014 à 01:02
OPEN A NEW SHEET AND CALL LIT "sum" (without quotes)

presume that you have used formula for totalling either "autosum" or using formula with =sum(....)

now try this macro

Sub test()
Dim j As Integer
Dim tot As Range
For j = 1 To Worksheets.Count
If Worksheets(j).Name = "sum" Then GoTo nextj
With Worksheets(j)
Set tot = .Cells.Find(what:="sum", lookat:=xlPart)
'MsgBox tot.Address
tot.EntireRow.Copy
With Worksheets("sum")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End With
End With

nextj:
Next j


End Sub