A
adketcham
I was watching a youtube video. ExcelVBAIsFun's video.
.
I followed his visual instruction (I am deaf so I cannot listen to hi
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. I
shows 7 columns.
I want it to pull the information from first column in the databas
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"
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.ListCount - 1, 1) = Cells(x, 2)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 2) = Cells(x, 3)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 3) = Cells(x, 4)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 4) = Cells(x, 5)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 5) = Cells(x, 6)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 6) = Cells(x, 7)
End If
Next x
End Sub
Code
-------------------
Any assistant with this will be greatly appreciated.
Ambe
I followed his visual instruction (I am deaf so I cannot listen to hi
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. I
shows 7 columns.
I want it to pull the information from first column in the databas
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"
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.ListCount - 1, 1) = Cells(x, 2)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 2) = Cells(x, 3)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 3) = Cells(x, 4)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 4) = Cells(x, 5)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 5) = Cells(x, 6)
Me.lbxClientLookUp.List(Me.lbxClientLookUp.ListCount - 1, 6) = Cells(x, 7)
End If
Next x
End Sub
Code
-------------------
Any assistant with this will be greatly appreciated.
Ambe