Create Named Range based on value in column

  • want to create a named range based on the value of in column B.

    For example (1, 21, great) (5, 21, sew) (6, 21, test) (7, 22, hi) (1, 21, random)


    I want to create named range with name: UNIT21, and from the data above the refersto should be A2:C4 and A6:C6. And another named range= UNIT22 for data with 22 in its column B.


    Problem now is, I don't know how to select the whole row from A:C for respective row. And how to add new data to existing named range instead of replacing the existing value like what my code is doing right now.

    A beginner in Excel VBA and programming.


    I've asked this question in another forum: https://stackoverflow.com/q/59006163/12420134.

  • You have posted this on another forum without providing a link, which is counter to Ozgrid rules.


    Please show consideration to people who help here by posting links to all forums where you have asked this question.

  • You have posted this on another forum without providing a link, which is counter to Ozgrid rules.


    Please show consideration to people who help here by posting links to all forums where you have asked this question.

    I am so sorry. This is my first time using OzGrid, and I wasnt aware of the rule. Edited the original post, accordingly.

  • Update: I already got the answer on how to create named range based on cell value.


    However, the value of named range becomes {...}. Right now, I'm figuring out how to add the named range to combobox.