Option Explicit
Sub TeamTotal()
Dim lngRow As Long
With Sheet1
'find "Team Total" position
lngRow = Application.WorksheetFunction.Match("Team Total", .Range("A:A"), 0)
'apply the sum formula
.Range("B" & lngRow).Formula = "=SUM(B1:B" & lngRow - 1 & ")"
End With
End Sub
is there any way to change this so that it runs the search on sheet2 but command button is on sheet1?
I have tried simply changing "With sheet1" to "With sheet2" but no joy.
Sub TeamTotal()
Dim lngRow As Long
With Sheet1
'find "Team Total" position
lngRow = Application.WorksheetFunction.Match("Team Total", .Range("A:A"), 0)
'apply the sum formula
.Range("B" & lngRow).Formula = "=SUM(B1:B" & lngRow - 1 & ")"
End With
End Sub
is there any way to change this so that it runs the search on sheet2 but command button is on sheet1?
I have tried simply changing "With sheet1" to "With sheet2" but no joy.