Hi Ayub
Sorry - I've been busy at work and not been on the forum for a good week or so.
In my code above (Post #20) you can add this requirement. The new code becomes:
If Target.Address = "$H$10" Then
With Range("E418").Validation
.Delete
'Change Validation to match Value
If Range("h10").Value = 3 Or Range("h10").Value = 4 Or _
(Range("H10").Value = 2 And Range("W10").Value = "Weld Surface") Then
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Continuous Wet Fluorescent"
'Set E418 to CWF if 3 or 4
Range("E418").Value = "Continuous Wet Fluorescent"
Else
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Continuous Wet,Continuous Wet Fluorescent"
End If
End With
End If
This is the line that has changed:
If Range("h10").Value = 3 Or Range("h10").Value = 4 Or _
(Range("H10").Value = 2 And Range("W10").Value = "Weld Surface") Then
Notice the addition of the (... And ...). This is how you check two cells at once. Also notice, we are not using the Target here, just normal Range statements.
Lastly - did you spot the underscore after the Or: _
This allows you to continue writing the code on the next line. It is treated as one line of code. This is useful when you have a long piece of code that scrolls past the end of the edit window, or you want to separate out pieces of code that are related, such as a bunch of Or/And statements.
I don't have an up to date copy of the spreadsheet, so I can't incorporate it for you. If you get stuck, upload the sheet and I'll have a look.
Best regards, Rob.
Bookmarks