View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Remove Validation Input Messages

Your code wouldn't throw any error messages due to use of the error handler,
try commenting On error resume next.

If the code fails it is probably due to mixed validation types on the sheet
or protection. If due to the mixed types it means looping each validation
cell, unless you have some other way of identifying areas that contain same
type of validation..

Sub NoDVinputMsg()
Dim rng As Range, cel As Range
Set rng = Nothing ' only if rng previously set
On Error Resume Next
Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeAllVa lidation)
If Not rng Is Nothing Then
bDummy = rng.Validation.ShowInput
If Err.Number = 0 Then
' all same type, no need to loop
With rng.Validation
.InputTitle = ""
.InputMessage = ""
End With
Else
On Error GoTo 0
For Each cel In rng
With cel.Validation
.InputTitle = ""
.InputMessage = ""
End With
Next
End If
End If
End Sub

BTW, if you only want to deisable the input messages and not permanently
remove them, just do
..ShowInput = False

Regards,
Peter T





"Code Numpty" wrote in message
...
Someone from another forum kindly gave me this code to remove all

validation
input messages from a worksheet but it doesn't work or throw any error
messages.

.................................................. ..........................
Sub RemoveValidationInputMsgs()
On Error GoTo None
With
ActiveSheet.UsedRange.SpecialCells(xlCellTypeAllVa lidation).Validation
.InputTitle = Empty
.InputMessage = Empty
End With
None:
On Error GoTo 0
End Sub

.................................................. ..........................
Any help appreciated with this, thanks.