sum with outcome to show userform

donny1shot

New Member
Joined
Mar 8, 2018
Messages
18
Hi All,
I am trying to create a vba code that shows a userform if C14 + C15 > C13. I have tried the below but it does not work.

Code:
If Range ("C14:C15").value > Range ("C13") then userform1.show
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi.

One solution :

Code:
If (Range("C14").Value + Range("C15").Value) > Range ("C13").Value Then UserForm1.show

Another one :

Code:
If WorksheetFunction.Sum(Range("C14:C15")) > Range ("C13").Value Then UserForm1.show
 
Last edited:
Upvote 0
you forgot to add .value after Range("C13")

If Range ("C14:C15").value > Range ("C13").value then userform1.show


I think that should work...

Edit: ooops. that doesn't work either. my mistake.
 
Last edited:
Upvote 0
you forgot to add .value after Range("C13")

If Range ("C14:C15").value > Range ("C13").value then userform1.show


I think that should work...

Code:
Range("C14:C15").Value
doesn't return the sum of the range but an array of the values in range, like : {1, 2}
If C14 = 1 and C15 = 2
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top