angumaniraj
New Member
- Joined
- Nov 4, 2019
- Messages
- 4
Hi all,
I'm in need of a Check Box in Drop down list for multiple selection. The code which i had is given below. The disadvantages of the given code was duplication and unable to edit the selection.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Oldvalue As String
Dim Newvalue As String
On Error GoTo Exitsub
If Target.Address = "$C$15" 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
Target.Value = Oldvalue & " | " & Newvalue
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
Please help me by providing an alternative solution(s), which suits to eliminate the above mentioned disadvantages.
Regards
Angumaniraj GV
I'm in need of a Check Box in Drop down list for multiple selection. The code which i had is given below. The disadvantages of the given code was duplication and unable to edit the selection.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Oldvalue As String
Dim Newvalue As String
On Error GoTo Exitsub
If Target.Address = "$C$15" 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
Target.Value = Oldvalue & " | " & Newvalue
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
Please help me by providing an alternative solution(s), which suits to eliminate the above mentioned disadvantages.
Regards
Angumaniraj GV