Hi
I am new in VBA and trying to get a multicolumn in my ListBox in Excel Userform ,If i select a particular sheet.Presently I can Select a sheet
but in the List box it is putting all the data in one List
Hi
I am new in VBA and trying to get a multicolumn in my ListBox in Excel Userform ,If i select a particular sheet.Presently I can Select a sheet
but in the List box it is putting all the data in one List
Private Sub CommandButton1_Click() Dim i As Long Dim wsMyWks As String Dim nRow As Long Dim mRow As Range wsMyWks = ComboBox1.Value With Me.ListBox1 .BoundColumn = 1 .ColumnCount = 4 .TextColumn = True nRow = Worksheets(wsMyWks).Range("A65536").End(xlUp).Row For Each mRow In Worksheets(wsMyWks).Rows("1:" & nRow) .AddItem mRow.Cells(1, 1).Value For i = 2 To 7 .List(.ListCount - 1, i - 1) = mRow.Cells(1, i).Value Next i Next mRow End With MsgBox "Paste your code to get info from userform to worksheet here" End Sub
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
You are Genius, I was trying to do this from last 2 whole daysand you did it in
half an hour
Oh I don't think it took him that long.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link