Macros based on Data Validation !!

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
The Worksheet_Change event procedure will fire if the user changes a cell that contains Data Validation, if that's what you mean.
 
Upvote 0
Even if the cell in question doesn't actually change. Grr!
 
Upvote 0
Thank you. yes I was looking for Worksheet_SelectionChange but can i get code to simple macro to run on basis of Data Validation.

I have a data validation in Cell C4 When user changes it a macro should fire.

Thank you so much.
 
Upvote 0
Yes, you need the Worksheet_Change event procedure. Example:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address <> "$C$4" Then Exit Sub
'   Replace next line with your code
    MsgBox "You changed " & Target.Address(False, False)
End Sub
 
Upvote 0
Hi

I need to have the excel cell (say A2) accept only one value,say "ABC".The cell should not accept any other value except "ABC".Could someone help me with the code?

Many thanks!!
kissu
 
Upvote 0
Thank you very much, but i want to use VB code to do this.
I need to do validate 20 cells with different criteria.

For eg.,I need one cell to accept any of the two values,say "ABC" or "DEF"
i.e.,the particular cell should accept any of those two values only and if any thing is typed other than these two strings then it should n't allow the person to enter the value....


It may seem very basic but I an amateur and keen to learn macros.
Please help me here..

many thanks once again for your response!!
 
Upvote 0
If the Data Validation, List option was chosen, then the user would be prompted with the required result(s).
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

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