FunsizedNerd
New Member
- Joined
- Mar 20, 2019
- Messages
- 17
This is my code:
'Select range
Set rng1 = Range("K5:N5")
Set rng2 = Range("H6:N56")
Set rng3 = Range("H57:K57")
Set totalrng = Union(rng1, rng2, rng3)
totalrng.Select
'Call SumPassengers sub
For Each cell In totalrng
Call SumPassengers
Next cell
The SumPassengers sub is a large number of if statements and sumifs (that works fine). When I run this code, it puts the sum total in for the first cell in the range (K5) but none of the others in the selected range. How can I fix this?
'Select range
Set rng1 = Range("K5:N5")
Set rng2 = Range("H6:N56")
Set rng3 = Range("H57:K57")
Set totalrng = Union(rng1, rng2, rng3)
totalrng.Select
'Call SumPassengers sub
For Each cell In totalrng
Call SumPassengers
Next cell
The SumPassengers sub is a large number of if statements and sumifs (that works fine). When I run this code, it puts the sum total in for the first cell in the range (K5) but none of the others in the selected range. How can I fix this?