• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Cell value separation as a data for drop down list

Kiril

New Member
Hello,

Could you help me on creating and formula to solve following issue?

I have column A with following cell values x1;x2;x3 or x1;x2 or x1

where x1 x2 and x3 are integers between (1-99).

I need to create a drop down list in corresponding cells in column B
with following choices:
x1
x2, if exists
x3, if exists


any ideas or hints are welcomed.

Thank you in advance.
Kiril
 
Hi:

The following macro will do what you are looking for
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False

If Not Intersect(Target, Range("B:B")) Is Nothing Then
    strng$ = Cells(Target.Row, 1).Value
    myArray$ = WorksheetFunction.Substitute(strng, ";", ",")
        With Cells(Target.Row, 2).Validation
            .Delete
            On Error Resume Next
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
            xlBetween, Formula1:=myArray
        End With
End If

Application.ScreenUpdating = True
End Sub

Thanks
 

Attachments

  • Book1.xlsm
    16.2 KB · Views: 3
Thank you Thomas,

But I trying to find non-VBA solution that could be paste in data validation entry or in a column for further list creation.

Thanks
 
You'd need helper column(s) for that.

Either do it on the same sheet or on another sheet.

See attached sample using dynamic named range.
 

Attachments

  • Book1 (2).xlsb
    10.9 KB · Views: 5
Back
Top