xbanditlordx
05-04-2021, 08:12 PM
I currently have a spreadsheet setup as:
Apple
100
Banana
50
Total Fruit
I want to know the total of the fruits (where there are more fruits in my actual spreadsheet).
Currently I have:
Sub Sum()
Dim FirstFruit As Range
Dim LastFruit As Range
Dim TotalFruits As Range
Set TotalFruits = Range("A:A").Find("Total Fruits", MatchCase:=True, Lookat:=xlPart).Offset(0, 1)
Set FirstFruit = Range("A:A").Find("Apple", MatchCase:=True, Lookat:=xlPart)
Set LastFruit = Range("A:A").Find("Banana", MatchCase:=True, Lookat:=xlPart)
TotalFruits = ?????????????????????????????
End Sub
How do I basically say that I want TotalFruits to be equal to the SUM of cells that exists between FirstFruit and LastFruit?
Apple
100
Banana
50
Total Fruit
I want to know the total of the fruits (where there are more fruits in my actual spreadsheet).
Currently I have:
Sub Sum()
Dim FirstFruit As Range
Dim LastFruit As Range
Dim TotalFruits As Range
Set TotalFruits = Range("A:A").Find("Total Fruits", MatchCase:=True, Lookat:=xlPart).Offset(0, 1)
Set FirstFruit = Range("A:A").Find("Apple", MatchCase:=True, Lookat:=xlPart)
Set LastFruit = Range("A:A").Find("Banana", MatchCase:=True, Lookat:=xlPart)
TotalFruits = ?????????????????????????????
End Sub
How do I basically say that I want TotalFruits to be equal to the SUM of cells that exists between FirstFruit and LastFruit?