Satchmo_Pops
New Member
- Joined
- Feb 9, 2012
- Messages
- 10
Hey Everyone,
Here is my current dilemma. I currently have a UserForm that searches for a company name and returns the values to specified fields in a form. I want to add a scroll bar or a button to be able to load the next entry that matches the users input (i.e. Company ABC has two different divisions that are entered into a database. I want to be able to scroll through to be able to grab the second entry if the first one isn't the one I want.)
Here is the code I'm using for finding the value:
Thanks again for your help!
Here is my current dilemma. I currently have a UserForm that searches for a company name and returns the values to specified fields in a form. I want to add a scroll bar or a button to be able to load the next entry that matches the users input (i.e. Company ABC has two different divisions that are entered into a database. I want to be able to scroll through to be able to grab the second entry if the first one isn't the one I want.)
Here is the code I'm using for finding the value:
Code:
Private Sub SearchComp_Click()
Dim rngFind As Range
Dim ws As Worksheet
Set ws = Worksheets("Donor List")
Set rngFind = ws.Range("b1:b64000").Find(Me.SearchCompBox.Value, Lookat:=xlWhole)
If rngFind Is Nothing Then
MsgBox "This Donor Was Not Found. Please Try Again", vbInformation
Else
MsgBox "Donor " & Me.SearchCompBox.Value & " has been found!", vbOKOnly
Me.donor = rngFind.Offset(0, -1).Value
Me.CompName = rngFind.Offset(0, 0).Value
Me.fname = rngFind.Offset(0, 1).Value
Me.lname = rngFind.Offset(0, 2).Value
Me.initial = rngFind.Offset(0, 3).Value
Me.apt = rngFind.Offset(0, 4).Value
Me.Streetname = rngFind.Offset(0, 5).Value
Me.Streetname2 = rngFind.Offset(0, 6).Value
Me.city = rngFind.Offset(0, 7).Value
Me.province = rngFind.Offset(0, 8).Value
Me.postal = rngFind.Offset(0, 9).Value
cmdmig.Enabled = True
End If
End Sub
Thanks again for your help!