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.
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: