i trying select multiple values in excel 2 different drop down lists. have code can select multiple values on 1 drop down , able same drop down list different values. can use code below , modify or there easier way this?
private sub worksheet_change(byval target range) dim rngdv range dim oldval string dim newval string if target.count > 1 goto exithandler on error resume next set rngdv = cells.specialcells(xlcelltypeallvalidation) on error goto exithandler if rngdv nothing goto exithandler if intersect(target, rngdv) nothing 'do nothing else application.enableevents = false newval = target.value application.undo oldval = target.value target.value = newval if target.column = 7 or target.column = 45 if oldval = "" 'do nothing else if newval = "" 'do nothing else target.value = oldval _ & ", " & newval end if end if end if end if exithandler: application.enableevents = true end sub
private sub worksheet_change(byval target range) dim rngdv range dim oldval string dim newval string if target.count > 1 goto exithandler on error resume next set rngdv = cells.specialcells(xlcelltypeallvalidation) on error goto exithandler if rngdv nothing goto exithandler if intersect(target, rngdv) nothing 'do nothing else application.enableevents = false newval = target.value application.undo oldval = target.value target.value = newval if target.column = 7 or target.column = 45 if oldval = "" 'do nothing else if newval = "" 'do nothing else target.value = oldval _ & ", " & newval end if end if end if end if exithandler: application.enableevents = true end sub i used conditional or make possible select multiple values 2 different drop down lists. shown in code if target.column = 7 or target.column = 45 then
Comments
Post a Comment