Page 1 of 1
ListBox
Posted: Wed May 06, 2020 3:50 pm
by sna
Hi Dear All,
I need to ask you VBA expert.
how can we select the columns then those columns will populate on ListBox.
I mean use mouse selecting those columns
I attached the template
Thanks
Re: ListBox
Posted: Wed May 06, 2020 6:17 pm
by snasui

Sorry for inform you about VBA question, one of the rule of this forum is needed some code from yourself that try to solve this problem and have that code inside your example file.
Re: ListBox
Posted: Wed May 06, 2020 9:20 pm
by sna
Hi Dear
I have attached file with code inside
Re: ListBox
Posted: Wed May 06, 2020 9:21 pm
by sna
I also attached sample file with macro
Re: ListBox
Posted: Wed May 06, 2020 9:53 pm
by snasui

Please check your attached file again. I have not found any piece of code.
Re: ListBox
Posted: Wed May 06, 2020 10:27 pm
by sna
I need your help to select non contiguous columns with or without inputbox
Re: ListBox
Posted: Wed May 06, 2020 10:38 pm
by sna
Here is the code
Re: ListBox
Posted: Wed May 06, 2020 11:38 pm
by snasui

The example code is below:
Code: Select all
Private Sub UserForm_Activate()
'On Error Resume Next
Dim rRange As Range, rList As Range, strRowSource As String
Set rRange = Application.InputBox(Prompt:="Please Select Range", _
Title:="Range Select", Type:=8)
With Sheets("Sheet1")
If .Range("l2") <> "" Then .Range("l2").CurrentRegion.ClearContents
rRange.Copy .Range("l2")
Set rList = .Range("l2").CurrentRegion
strRowSource = .Name & "!" & rList.Address(0, 0)
Me.ListBox1.RowSource = strRowSource
End With
End Sub
Re: ListBox
Posted: Thu May 07, 2020 6:37 pm
by sna
Thanks