Nelson78
Well-known Member
- Joined
- Sep 11, 2017
- Messages
- 526
- Office Version
- 2007
Hello everybody.
I've four cells populated with percentages: I need to check if the sum of them is 100%.
I've tried as you can see below, but it's not correct (if the sum is exactly 100%, the macro shows me the msgbox).
Can you help me, please?
I've four cells populated with percentages: I need to check if the sum of them is 100%.
I've tried as you can see below, but it's not correct (if the sum is exactly 100%, the macro shows me the msgbox).
Can you help me, please?
VBA Code:
If Cell.Offset(0, 1).Value + Cell.Offset(0, 2).Value + Cell.Offset(0, 3).Value + Cell.Offset(0, 4).Value <> 1 Then
msgbox "Sum is not 100%"
end if