Hi,
I have the below code, which enables me to select multiple options from a drop-down menu.
However, I want to amend this to column I, J and K - but the code is not letting me go any further than I37 (it goes red). This does coincide when it moves to the next line if this could be the issue?
If anyone can help me it'd be much appreciated!
I have the below code, which enables me to select multiple options from a drop-down menu.
However, I want to amend this to column I, J and K - but the code is not letting me go any further than I37 (it goes red). This does coincide when it moves to the next line if this could be the issue?
If anyone can help me it'd be much appreciated!
PHP:
Private Sub Worksheet_Change(ByVal Target As Range)
'Code by Sumit Bansal from https://trumpexcel.com' To make mutliple selections in a Drop Down List in Excel
Dim Oldvalue As StringDim Newvalue As String
On Error GoTo ExitsubIf Target.Address = "$H$2" Or Target.Address = "$H$3" Or Target.Address = "$H$4" Or Target.Address = "$H$5" Or Target.Address = "$H$6" Or Target.Address = "$H$7" Or Target.Address = "$H$8" Or Target.Address = "$H$9" Or Target.Address = "$H$10" Or Target.Address = "$H$11" Or Target.Address = "$H$12" Or Target.Address = "$H$13" Or Target.Address = "$H$14" Or Target.Address = "$H$15" Or Target.Address = "$H$16" Or Target.Address = "$H$17" Or Target.Address = "$H$18" Or Target.Address = "$H$19" Or Target.Address = "$H$20" Or Target.Address = "$H$21" Or Target.Address = "$H$22" Or Target.Address = "$H$23" Or Target.Address = "$H$24" Or Target.Address = "$H$25" Or Target.Address = "$H$26" Or Target.Address = "$H$27" Or Target.Address = "$H$28" Or Target.Address = "$H$29" Or Target.Address = "$H$30" Or Target.Address = "$H$31" Or Target.Address = "$H$32" Or Target.Address = "$H$33" Or Target.Address = "$H$34" Or Target.Address = "$H$35" Or Target.Address = "$H$36" Or Target.Address = "$H$37" 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 IfEnd IfApplication.EnableEvents = TrueExitsub:Application.EnableEvents = TrueEnd Sub
Last edited: