Hi, I have a Userform with 2 listboxes, users can add from listbox 1 to listbox 2. Submit button sends Listbox2 lists as a string to a cell with delimiter.
Everything works fine except when Listbox 2 is empty; it gives Runtime 381 error. i.e. if a user wants to remove everything from list2.
I need a condition where if the listbox 2 is empty (hence x has no value), then offset(0,17) value should be also 0.
Many thanks in advance.
Everything works fine except when Listbox 2 is empty; it gives Runtime 381 error. i.e. if a user wants to remove everything from list2.
Code:
x = ListBox2.List(0)
For i = 2 To ListBox2.ListCount
x = x & ", " & ListBox2.List(i - 1)
Next I
Range.Offset(0, 17).Value = x
I need a condition where if the listbox 2 is empty (hence x has no value), then offset(0,17) value should be also 0.
Many thanks in advance.
Last edited: