Seb
Seb

Reputation: 3835

Round up to the nearest whole even number

I think a simple maths question, I'm looking for an algorithm to round up to the nearest whole even number so

4.4 = 6
5.1 = 6
2.1 = 4
1.9 = 2 etc....

If you could give me the VBA syntax that would be awesome. I know excel as =even(..) function but I can't get it to work in VBA.

Thank you

Upvotes: 1

Views: 773

Answers (1)

Peter Albert
Peter Albert

Reputation: 17495

You can simply use the Excel function using:

Application.WorksheetFunction.Even(YourNumber)

Upvotes: 4

Related Questions