Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals of Financial Accounting

Authors: Fred Phillips, Robert Libby, Patricia Libby

5th edition

78025915, 978-1259115400, 1259115402, 978-0078025914

More Books

Students also viewed these Finance questions