Messagebox issues

CV899000

Board Regular
Joined
Feb 11, 2016
Messages
98
Hello,

I have a workbook that I use to choose equipment and calculate prices, and other users also uses this workbook, so it needs to be as user friendly as possible.

I have then created a code that prompts a messagebox if the value in cell B10 exceeds 1.
The same is done for cell B10.

The messageboxes tells the user that two of the equipment type has been chosen, and that they need to decide on a amount of a cost further down the page. The user can then type a amount into the messagebox and press OK, and the workbook uses that value in another cell.

However, I then have a reset macrobutton that I use to reset all choices made in the workbook, and when that is pressed the value in cell B10 and B13 in set to nothing ("").
The messageboxes then prompts, but that is NOT what I want. I ONLY want the messageboxes to prompt if the values in cell B10 and B13 exceeds 1.

Please see code below.

Code:
If Target.Address = Range("B10").Address Then
   If Target.Value = "1" Then
        Worksheets("Choose sheet").Range("B30").Value = "1"
    Exit Sub
    End If
    description = InputBox("More than 1 module has been chosen. Please choose quantity of Miscellaneous costs.")
    If description = "" Then Exit Sub
    Worksheets("Choose sheet").Range("B30").Value = description
End If
If Target.Address = Range("B13").Address Then
   If Target.Value = "1" Then
        Worksheets("Choose sheet").Range("B31").Value = "1"
    Exit Sub
    End If
    description = InputBox("More than 1 module has been chosen. Please choose quantity of Miscellaneous costs.")
    If description = "" Then Exit Sub
    Worksheets("Choose sheet").Range("B31").Value = description
End If
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You currently have your message boxes appear based solely on whether B10 or B13 are the target cells.
You do have IF statements underneath them, but you have the message boxes outside of those IF statements.
So you either want to move it inside the IF THEN block, or create a new IF THEN block to put it in, i.e.
Code:
If Target.Value >1 Then
    MsgBox ...
End If
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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