Is it possible to automatically change a users input in a cell if it doesn't meet certain criteria?

Recompense

New Member
Joined
Jan 16, 2020
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
I'm trying to set up a cell where a user can enter a dollar amount and have excel check if that amount meets the minimum threshold I've set, AND if it does not, automatically update their input to the minimum amount.
eg. cell A1 is blank and awaiting users input, I've specified it needs to be >= to 10% of 500 but the user enters 25 into cell A1, I want the program to change their answer within cell A1 to 50. Is this possible with excel?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try Data Validation

or via code:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
       If Target.Value < 50 Then Target.Value = 50
End If
End Sub
 
Upvote 0
Another method :

VBA Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Range("A1").Value = "" Then
        Range("A1").Value = ""
    ElseIf Range("A1").Value < 50 Then
        Range("A1").Value = 50
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

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