macro to create warning popup if a condition is true

fingermouse

Board Regular
Joined
Dec 13, 2013
Messages
117
Hi,

I've been asked to with find a macro-based solution to the following task, hope someone can help.

On an Excel worksheet, I have a range of cells within a column. For example, A2:A30.

In each of these cells there's a numerical value.

In column B of the same worksheet , I have a drop down list with 4 user options. The list applies to cells B2:B30.

The options are 'Compulsory' Voluntary' 'None' and 'Not applicable'

If a value in a column A cell is less than 250,000 (0 to 24,999) the user cannot select 'Compulsory' in the corresponding cell in column B. if the user attempts to do so, I want a pop-up message which states "threshold not met - please select 'none'. "

is this possible? Any help very much appreciated.

Thanks, Cal.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi Cal, try this in the sheet module

Howard

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Intersect(Target, Range("B2:B30")) Is Nothing Then Exit Sub
   If Target.Count > 1 Then Exit Sub
   
   If Target.Offset(, -1).Value < 250000 And Target.Value = "Compulsory" Then
     MsgBox "Threshold not met - please select ""none"""
     
     Target.ClearContents
     Target.Activate
     Exit Sub
   End If
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,847
Members
449,051
Latest member
excelquestion515

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