Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error 1004 when using VBA to set Validation from list on another s
Hi,
I get Error 1004 when I use the following code to set Validation using a list on another sheet. Lookup List Name: ProductTypes Range to apply Validation to: rngValidate2 The list is on another page but the help seems to indicate all you have to do is put the range name in the formula without the sheet name. Thanks, MikeZz Sub Test_Add_Validation() Dim rngValidate2 As Range Set rngValidate2 = Selection Call A91_Set_Basic_Validation(rngValidate2, "=ProductTypes") End Sub Private Sub A91_Set_Basic_Validation(rng As Range, lookupFormula) With rng.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _ Operator:=xlBetween, Formula1:=lookupFormula .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error 1004 when using VBA to set Validation from list on another s
Mike,
It should work, check for a typo in the Lookup List Name. Regards, Per "MikeZz" skrev i meddelelsen ... Hi, I get Error 1004 when I use the following code to set Validation using a list on another sheet. Lookup List Name: ProductTypes Range to apply Validation to: rngValidate2 The list is on another page but the help seems to indicate all you have to do is put the range name in the formula without the sheet name. Thanks, MikeZz Sub Test_Add_Validation() Dim rngValidate2 As Range Set rngValidate2 = Selection Call A91_Set_Basic_Validation(rngValidate2, "=ProductTypes") End Sub Private Sub A91_Set_Basic_Validation(rng As Range, lookupFormula) With rng.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _ Operator:=xlBetween, Formula1:=lookupFormula .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Runtime-error 1004 (excel 2007) when selecting validation list optiontriggering worksheet_change property | Excel Programming | |||
data Validation Dependent List Error | Excel Discussion (Misc queries) | |||
1004 Cell Protected Error for data validation lists when locked and protected | Excel Programming | |||
Error 1004 with Data Validation in VBA | Excel Programming | |||
Sorting a 2 column list with VBA using Worksheet change produces 1004 error | Excel Programming |