My workbook contains 7 dropdown lists and a formula to return values upon criteria selection. The formula was working well until I added a macro to reset all cells to blank. Now, however, it only returns "none" rather than selecting the actual return value. I also added a macro to make multiple selections on the first dropdown list, but the formula failed after the clear macro was added.
code to reset dropdowns
[Public Sub resetDVs()
[b5:h5,b8] = " "
End Sub]
code to allow multiple choices
[Private Sub Worksheet_Change(ByVal Target As Range)
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Not Intersect(Target, Range("b5")) Is Nothing Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
Else
If InStr(1, Oldvalue, Newvalue) = 0 Then
Target.Value = Oldvalue & vbNewLine & Newvalue
Else:
Target.Value = Oldvalue
End If
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub]
Bookmarks