Listbox with 17 columns

FAD

New Member
Joined
Feb 23, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi All,
I am a dummy in VBA excel. I need help with the user form to display 12 columns from 17 columns worksheet that is from column 1:10,16,17. and columns 11:15 in the popup user form 2 in text box. I have copied some codes from the net it works, On a start-up it displays all the records in the list box with above mention format. When I use search the particular record it displays only 1:10 columns and on 11th column it gives me error. Due to limitations of List box Add Items. I don't know how to change the codes. Anyone Please help me to rewrite the code for the attached procedure. Thanks in advance.
VBA Code:
Dim isim As Range, liste As Long

Private Sub cmdbul1_Click()
Application.ScreenUpdating = False
ListBox2.RowSource = Empty
For Each isim In Range("b3:b" & Range("b" & Rows.Count).End(xlUp).Row)
    If UCase(LCase(isim)) Like UCase(LCase(TextBox1)) & "*" Then
        liste = ListBox2.ListCount
            ListBox2.AddItem
            ListBox2.List(liste, 0) = isim
            ListBox2.List(liste, 1) = isim.Offset(0, 1)
            ListBox2.List(liste, 2) = isim.Offset(0, 2)
            ListBox2.List(liste, 3) = isim.Offset(0, 3)
            ListBox2.List(liste, 4) = isim.Offset(0, 4)
            ListBox2.List(liste, 5) = isim.Offset(0, 5)
            ListBox2.List(liste, 6) = isim.Offset(0, 6)
            ListBox2.List(liste, 7) = isim.Offset(0, 7)
            ListBox2.List(liste, 8) = isim.Offset(0, 8)
            ListBox2.List(liste, 9) = isim.Offset(0, 9)
            ListBox2.List(liste, 10) = isim.Offset(0, 10) ' I am getting this error here "Could not set the list property. Invalid property value.", because of it limitations, which allows only 10 columns
            ListBox2.List(liste, 11) = isim.Offset(0, 11) ' from 'Liste 0-9'. I want to change the code here with something else, which can display
                                                        ' first 10 and last 2 columns here. And the middle five columns in the text box below.
                                                       
          End If
Next
Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:

FAD

New Member
Joined
Feb 23, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
It is doing that procedure with the search results. it has to display there search results. Will your code work there? For your understanding I can attach my workbook it not complex just simple. Is it possible to attach a workbook, How?
Thanks for your help. Fluff, has written a new code for that procedure and it worked.
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Watch MrExcel Video

Forum statistics

Threads
1,126,956
Messages
5,621,816
Members
415,857
Latest member
braunReivn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top