Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
error with data validation
Hi all,
I have a strange problem: when I set the data validation manually on a specific cell, this works without problems. However, when I record the macro and try to execute the code, I get an "application or object defined error" (on the .Add bit). Is there anything wrong with the following code? Sub Macro7() With Selection.Validation .Delete .Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=A1=round(A1;2)" .IgnoreBlank = False .InCellDropdown = True .InputTitle = "" .ErrorTitle = "Input error" .InputMessage = "" .ErrorMessage = "Please enter amounts rounded to not more than 2 decimals!" .ShowInput = False .ShowError = True End With End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
error with data validation
Thanks Mark, you set me on the right track:
The recorder has recorded a ";" but the correct syntax is "," Both the following now work: Formula1:="=a1=round(a1,2)" Formula1:="A1=Round(A1, 2)" -----Original Message----- change the Formula1 to read Formula1:=A1 = Round(A1, 2) Mark D "Claude" wrote in message ... Hi all, I have a strange problem: when I set the data validation manually on a specific cell, this works without problems. However, when I record the macro and try to execute the code, I get an "application or object defined error" (on the .Add bit). Is there anything wrong with the following code? Sub Macro7() With Selection.Validation .Delete .Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=A1=round(A1;2)" .IgnoreBlank = False .InCellDropdown = True .InputTitle = "" .ErrorTitle = "Input error" .InputMessage = "" .ErrorMessage = "Please enter amounts rounded to not more than 2 decimals!" .ShowInput = False .ShowError = True End With End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Validation Error | Excel Discussion (Misc queries) | |||
Data Validation error | Excel Discussion (Misc queries) | |||
Data Validation Error | Excel Worksheet Functions | |||
#VALUE# error with Data Validation | Excel Discussion (Misc queries) | |||
Data Validation error ?? | Excel Worksheet Functions |