VBA code for Scroll bar or ClickButton to find next rngfind

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

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,207,255
Messages
6,077,311
Members
446,278
Latest member
hoangquan2310

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
Back
Top