Cell.Validation.ShowInput off after cell change

Zoticos

New Member
Joined
Jan 29, 2011
Messages
16
I used the macro below to turn off the data validation input message caption for the entire worksheet.

Now I was looking for a way to turn off message caption after a single cell value has been selected from the data validation drop down list.

I got it to work with the sendkey command:
Application.EnableCancelKey = xlDisabled
Application.SendKeys "{ESCAPE 2}", True

But it does take 1 1/2 sec. to remove the message caption. So I was looking for a faster VBA solution using perhaps the Cell.Validation.ShowInput command.


Thanks for your help!



Macro1:

Private Sub CellCaptionOFF_Click()
'Turn cell cation input message off
Dim Cell As Range
Dim ValObj As Validation

For Each Cell In ActiveSheet.UsedRange
Set ValObj = Cell.Validation
On Error Resume Next
ValObj.ShowInput = False
ValObj.ShowError = False
If Err = 1004 Then Err.Clear
On Error GoTo 0
Next Cell

Unload Me

End Sub


Macro2:

Private Sub CellCaptionON_Click()
'Turn cell cation input message on
Dim Cell As Range
Dim ValObj As Validation

For Each Cell In ActiveSheet.UsedRange
Set ValObj = Cell.Validation
On Error Resume Next
ValObj.ShowInput = True
ValObj.ShowError = True
If Err = 1004 Then Err.Clear
On Error GoTo 0
Next Cell

Unload Me
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,921
Latest member
BBQKING

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