Hi Macro Fool
This code is in the attached...see if it does as you require. Let me know of issues.
Option Explicit
Sub Sub_Tots()
Dim ws As Worksheet
Dim myTots As Variant
Dim myStart As Range
Dim myEnd As Range
Dim TopX As String
Dim TopY As String
Dim BotX As String
Dim BotY As String
Dim FormulaX As String
Dim FormulaY As String
Set ws = Sheets("Original")
For Each myTots In Array("Finance Company Totals:", "Organization Unit Totals :")
With ws.Columns("C")
'Find First
Set myStart = .Find(What:=myTots, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
TopX = myStart.Offset(0, 1).Address
TopY = myStart.Offset(0, 2).Address
'Find Last
Set myEnd = .Find(What:=myTots, _
After:=.Cells(1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)
BotX = myEnd.Offset(0, 1).Address
BotY = myEnd.Offset(0, 2).Address
FormulaX = "=Sum(" & TopX & ":" & BotX & ")"
FormulaY = "=Sum(" & TopY & ":" & BotY & ")"
ws.Range(myEnd.Address).Offset(1, 1).Formula = FormulaX
ws.Range(myEnd.Address).Offset(1, 2).Formula = FormulaY
End With
Next myTots
End Sub
Bookmarks