Range.Validation.Add problem with VBA
Hello ,
using the excel user interface, the following formula can be applied to a column.
– Userdefined
– formula: =IstZahl(A10)
This works properly.
I try to apply the same with VBA.
Dim formel as string
formel = “=IstZahl(A10)”
With column.Validation
.Delete
.Add Type:=xlValidateCustom, Operator:=xlEqual, Formula1:=formel, AlertStyle:=xlValidAlertStop
.IgnoreBlank = True
.InCellDropdown = False
.ErrorTitle = “Wert eingeben”
.InputMessage = “”
.ErrorMessage = “Der Wert darf keine Duplikate haben und muss eine Zahl sein.”
.ShowInput = False
.ShowError = True
End With
I get allways an error when the red line is executed.
I guess that the syntax is not correct but I find no error.
Manfred
Hello ,using the excel user interface, the following formula can be applied to a column.- Userdefined- formula: =IstZahl(A10)This works properly.I try to apply the same with VBA.Dim formel as stringformel = “=IstZahl(A10)”With column.Validation.Delete.Add Type:=xlValidateCustom, Operator:=xlEqual, Formula1:=formel, AlertStyle:=xlValidAlertStop.IgnoreBlank = True.InCellDropdown = False.ErrorTitle = “Wert eingeben”.InputMessage = “”.ErrorMessage = “Der Wert darf keine Duplikate haben und muss eine Zahl sein.”.ShowInput = False.ShowError = TrueEnd WithI get allways an error when the red line is executed.I guess that the syntax is not correct but I find no error.Manfred Read More