Data Validation

markoakes

Active Member
Joined
Jan 5, 2004
Messages
325
I’m not sure of the best way to do this. I have a customer data sheet that lists all customers. In column “B” is their Charge Status, either “Cash” or “Charge”. I want to stop the Charge Status from being changed from Cash to Charge if the Balance in Column “C” is greater then 5000.00 or the Account Status in column “D” is less then 2. Any help would be greatly appreciated.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hello,

Is this suitable?

It needs to go into the relevant sheet code window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 And UCase(Target.Value) = "CHARGE" Then
    If Range("C" & Target.Row).Value > 5000 Or Range("D" & Target.Row).Value < 2 Then
        MY_MSG = MsgBox("CANNOT CHANGE", vbOKOnly, "ERROR")
        Application.Undo
    End If
End If
End Sub
 
Upvote 0
The above code works great if "Charge" is being typed in the cell. Is there a way to make it work if Copy,Paste or Drag&Drop is used?
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,054
Latest member
juliecooper255

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