Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
In Excel on the Problem1 worksheet, create a function SumOddNumbers that will calculate the sum for the odd numbers for a selected range of cells.
In Excel on the Problem1 worksheet, create a function SumOddNumbers that will calculate the sum for the odd numbers for a selected range of cells. The code is below. Also, use your function to caclulate the sum for the odd numbers in the range B2:D4. Your answer should be in cell G5 on the Problem 1 worksheet.
Public Function SumOddNumbers (rng As Range)
Dim cell As Range
For Each cell In rng
If cell.Value Mod 2 = 1 Then
SUMODDNUMBERS = SUMODDNUMBERS + cell.Value
End If
Next cell
end Function
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started