Hi
I am using the following code to change the data validation source list based on the value in column "B"
It was working fine and then stopped. I get the error message at the lines;
.Add Type:=xlValidateList, Formula1:="=TempDescriptions"
.Add Type:=xlValidateList, Formula1:="=PermDescription"
Can anyone spot what is causing this problem.
Thanks
Steve
Application.EnableEvents = True
Select Case Target.Column
Case 1
With Selection
.Offset(, 1).FormulaR1C1 = "=RIGHT(RC[-1],9)"
.Offset(, 2).ClearContents
.Offset(, 5).ClearContents
End With
i = Selection.Row
'this section determines which list to use based on the the value in the cell in column "B"
If Cells(i, 2).Value = "Temporary" Then
With Cells(i, 3).Validation
.Delete
' Problem occurs here
.Add Type:=xlValidateList, Formula1:="=TempDescriptions"
End With
Else
With Cells(i, 3).Validation
.Delete
' Problem occurs here
.Add Type:=xlValidateList, Formula1:="=PermDescription"
End With
End If
End Select
Application.CutCopyMode = False
End Sub
I am using the following code to change the data validation source list based on the value in column "B"
It was working fine and then stopped. I get the error message at the lines;
.Add Type:=xlValidateList, Formula1:="=TempDescriptions"
.Add Type:=xlValidateList, Formula1:="=PermDescription"
Can anyone spot what is causing this problem.
Thanks
Steve
Application.EnableEvents = True
Select Case Target.Column
Case 1
With Selection
.Offset(, 1).FormulaR1C1 = "=RIGHT(RC[-1],9)"
.Offset(, 2).ClearContents
.Offset(, 5).ClearContents
End With
i = Selection.Row
'this section determines which list to use based on the the value in the cell in column "B"
If Cells(i, 2).Value = "Temporary" Then
With Cells(i, 3).Validation
.Delete
' Problem occurs here
.Add Type:=xlValidateList, Formula1:="=TempDescriptions"
End With
Else
With Cells(i, 3).Validation
.Delete
' Problem occurs here
.Add Type:=xlValidateList, Formula1:="=PermDescription"
End With
End If
End Select
Application.CutCopyMode = False
End Sub