Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation Error CH Excel Discussion (Misc queries) 1 January 26th 10 07:59 PM
Data Validation error Kristen Excel Discussion (Misc queries) 2 February 7th 08 02:36 PM
Data Validation Error Dileep Chandran Excel Worksheet Functions 7 November 8th 06 12:22 PM
#VALUE# error with Data Validation KG Excel Discussion (Misc queries) 1 May 28th 05 05:31 AM
Data Validation error ?? Anthony Excel Worksheet Functions 1 February 10th 05 03:52 PM


All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"