Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have code to restore validation in cells if any paste over new cells. I have noticed that changing validation demand a unprotected workbook and unprotection empty the clipbook. Since I don't wan't to empty the clipbook, I try to check if there is a validation and if it is - if it is right one. With this, I just empty clipbook if I need to. - This done by trying to compare Operators as following code: BUT I get 1004 error on "If .Operator = .." line. Why? Can anybody see the reason? Kind regards /tskogstrom Sub ValidationPercent(rng As Range) If Not rng.Validation Is Nothing Then ' if validation- is it correct one? With rng.Validation If .Operator = xlBetween Then If .Formula1 = "0" And .Formula2 = "100" Then GoTo endcode Else: GoTo validationcode End If End If End With Else: GoTo validationcode End If Exit Sub validationcode: Call UnProtectWB With rng.Validation .Delete .Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop, _ Operator:=xlBetween, Formula1:="0", Formula2:="100" .IgnoreBlank = False .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Call ProtectWB endcode: End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro or formula to compare columns and give a result of the odd o | Excel Discussion (Misc queries) | |||
how do i give differect color for validation list? | Excel Discussion (Misc queries) | |||
compare 2 dates and give the date conditions are met | Excel Programming | |||
corrupt program or file? How to tell? Or is it operator error? | Excel Discussion (Misc queries) | |||
Syntax error (missing operator) in query expression '6 Wescott Rd# | Excel Discussion (Misc queries) |