Forced Entry based on value

RobertCotton

Board Regular
Joined
Nov 1, 2010
Messages
99
I've searched the board but didn't find anything I thought would wokr for my particular problem.

I have a mileage tracking spreadsheet where I use cell validation in column C for the user to select either "Business" or "Personal". What I would like to do is force the user to make a numeric entry in column F if "Personal" is selected in Column C.

Does anyone have any thoughts on how to accomplish this?

Thanks
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
What do you mean by force them? You could have a pop-up box come up, you could have something appear in column F, etc, but I'm not sure how you'd "force" anyone to do anything really.
 
Upvote 0
I suppose force is the wrong choice of words. Although it would be nice if I could do so (i.e. acitvate the correponding cell in column F and not allow them to leave it unless a numeric value is enterd) Perhaps a prompt or message box is a better solution. Something like "you have selected Personal, Please enter your personal mileage in coulmn F".

Does this help?
 
Upvote 0
You'll have to paste this in the module for the worksheet in question (i.e. if its sheet1, paste it in the module for sheet1.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Left(Target.Address, 2) = "$c" Then Exit Sub
If Target.Value = "Personal" Then
Range("$f" & Right(Target.Address, Len(Target.Address) - 2)).Select
Range("$f" & Right(Target.Address, Len(Target.Address) - 2)).Interior.ColorIndex = 6
MsgBox "You have selected Personal, please enter your personal mileage in coulmn F"

End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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