Dim nHigh As Integer Dim cutoff As Currency Dim hTotal As Currency Dim grandTotal As Currency cutoff = InputBox("What sales value do you want to check for?") For j = 1 To 6 numberHigh = 0 For i = 1 To 36 If Range("Sales").Cells(i, j) >= cutoff Then _ nHigh = nHigh + 1 hTotal = hTotal + Range("Sales").Cells(i, j).Value Next i MsgBox "For region " & j & ", sales were above " & Format(cutoff, "$0,000") _ & " on " & nHigh & " of the 36 months." MsgBox "Total High Values = " & hTotal grandTotal = grandTotal + hTotal nHigh = 0 hTotal = 0 Next j MsgBox "Grand Total High Values = " & Format(grandTotal, "$0,000,000") End Sub
Dim nHigh As Integer Dim cutoff As Currency Dim hTotal As Currency Dim grandTotal As Currency cutoff = InputBox("What sales value do you want to check for?") For j = 1 To 6 numberHigh = 0 For i = 1 To 36 If Range("Sales").Cells(i, j) >= cutoff Then _ nHigh = nHigh + 1 hTotal = hTotal + Range("Sales").Cells(i, j).Value Next i MsgBox "For region " & j & ", sales were above " & Format(cutoff, "$0,000") _ & " on " & nHigh & " of the 36 months." MsgBox "Total High Values = " & hTotal grandTotal = grandTotal + hTotal nHigh = 0 hTotal = 0 Next j MsgBox "Grand Total High Values = " & Format(grandTotal, "$0,000,000") End Sub