LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 2
Default Custom Fill in Listbox

I was watching a youtube video. ExcelVBAIsFun's video. http://www.youtube.com/watch?v=ulIraDmhF0o.

I followed his visual instruction (I am deaf so I cannot listen to him talk). I have this error message when I run the button.

I have this client search page on one sheet and the database on other. I saved the database as namebox and used the listbox to link to it. It shows 7 columns.

I want it to pull the information from first column in the database sheet to the listbox (in client search page).

Error message is this, "Run-time error'-2147467259 (80004005)': Unspecified error.

When I clicked debug, it yellow highlighted "Me.lbxClientLookUp.Clear" When I deleted it. It went to the next line. "For x = 2 To lr" When I hovered over that line, it says X = Empty.

[code]
Private Sub cmbClientSearch_Click()
crit = Range("C4")

If Cells(Rows.Count, 1).End(xlUp).Row = 1 Then
lr = 2
Else
lr = Cells(Rows.Count, 1).End(xlUp).Row
End If

Me.lbxClientLookUp.Clear

For x = 2 To lr
If Cells(x, 2) = crit Then
'write it to lbx
Me.lbxClientLookUp.AddItem Cells(x, 1)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCou nt - 1, 1) = Cells(x, 2)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCou nt - 1, 2) = Cells(x, 3)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCou nt - 1, 3) = Cells(x, 4)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCou nt - 1, 4) = Cells(x, 5)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCou nt - 1, 5) = Cells(x, 6)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCou nt - 1, 6) = Cells(x, 7)

End If

Next x


End Sub
[code]

Any assistant with this will be greatly appreciated.

Amber

Last edited by adketcham : August 18th 13 at 01:54 AM
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox, fill by format Steve Excel Programming 5 July 6th 07 01:28 AM
fill a listbox with data Arjan Excel Programming 6 October 24th 06 02:49 PM
Looping to fill ListBox davidm Excel Programming 2 January 5th 06 08:39 AM
Unable to fill Listbox thru VBA rash Excel Programming 6 December 20th 05 01:51 PM
For..next.. help to fill listbox jasonsweeney[_69_] Excel Programming 1 April 20th 04 09:25 PM


All times are GMT +1. The time now is 02:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"