View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Emmery[_2_] Tom Emmery[_2_] is offline
external usenet poster
 
Posts: 9
Default Validation error when worksheet is protected

Hi,

Below code works fine as long as I do not protect my workbook, but gives an
error when protected. How to solve this ?

Runtime error '-2147417848 (80010108)'
Method 'Modify' of object 'Validation failed'

With Worksheets(1).Range("G14").Validation
.Modify xlValidateDecimal, xlValidAlertStop, xlBetween, "1.0", "7.0"
.ErrorMessage = "Enter value between 1,0 and 7,0" + EOL + "Use end of
line"
.ShowInput = False
.ErrorTitle = "Invalid input"
.ShowError = True
End With

I've already tried ActiveWorkbook.Unprotect, Add Type iso Modify and
Validation.delete before add / modify. None of these alternatives seem to
work.
Cell G14 is not locked and not hidden.

Why is protect workbook causing this error, and how to solve this ?