View Single Post
  #1   Report Post  
frankjh19701 frankjh19701 is offline
Member
 
Posts: 89
Post Combine Multiple Macros

I have two Macros:

Dim sh2 As Worksheet, finalrow As Long
Dim i As Long, lastrow As Long
Set sh2 = Sheets("123-2205587527")
finalrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To finalrow
If Cells(i, 3).Value = "2205587527" Then
lastrow = sh2.Cells(Cells.Rows.Count, 1).End(xlUp).Row
Cells(i, 1).EntireRow.Copy Destination:=sh2.Cells(lastrow + 1, 1)


Range("M2").Select
FIRST_ROW = ActiveCell.Row
Selection.End(xlDown).Select
LAST_ROW = ActiveCell.Row
Selection.Offset(2, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[" & FIRST_ROW - LAST_ROW - 2 & "]C:R[-2]C)"
Range("M18").Select

I want to combine them so I can have the consolidated Macro look up a selected sheet within the workbook, find the selected column with values in it, get a SUM of that column, return value of the SUM to another sheet within the same workbook titled "Totals."

The goal is to be able to gather the totals of many sheets into one for reporting purposes.

Is this possible?

Any/all assistance will be greatly appreciated.

Thank you