Spinbutton on UserForm to click through a subset of "searched" rows - is this possible?

JimboG

New Member
Joined
Aug 7, 2013
Messages
2
Hello there,

I am chancing my arm here to ask if I could possibly get some assistance with setting up a spinbutton on a userform I am building to allow me to "cycle" through a subset of rows on a worksheet that have previously been "searched" for using another command button? (I am using Excel 2010)

To clarify, I have a single worksheet with about 30 columns of data (Computer Asset Inventory) that have common and unique values amoungst the columns.

I have so far been able to build a userform with a mixture of text boxes and combo boxes that do lookups using a lookup worksheet with some success, and I have also been able to build the beginnings of a "Search" command button that will let me search on a single field (column) to display the first row that matches from the same worksheet. But due to setting up some dummy data I know that I only get the first result of say three rows that could possibly match - what I'd like to do (if it is possible) is to have a spinbutton on the same userform so that I can "cycle" through the other two records (rows) - and if I could see the number of results and the relative record I was on that would be amazing!

I realise that I may be asking a lot here, but I've got most of it working, but the spinbutton and search bit is stumping me a bit - I've not done any VBA before two days ago, so have picked up what I can by reading and YouTubing! :)

Happy to start simple to understand the syntax and then build it out from there, or I can give full examples of what I have so far, whatever works for you.

Thanks very much for any advice you may be able to offer.

Currently, my "Search" button does this - it looks at single field at present called "Hostname on Guest"

Private Sub CommandButton1_Click()


row_number = 0
Do
DoEvents
row_number = row_number + 1
item_in_review = Sheets("VMGuests").Range("F" & row_number)
If item_in_review = txtHostNameOnGuest.Text Then
txtDateAudited = Sheets("VMGuests").Range("A" & row_number)
cboAuditedBy = Sheets("VMGuests").Range("B" & row_number)
cboState = Sheets("VMGuests").Range("C" & row_number)
cboHost = Sheets("VMGuests").Range("D" & row_number)
End If
Loop Until item_in_review = ""


End Sub

This works quite well so far - but I know that the record it shows me (based on what I see in the DateAudited, AuditedBy, State and Host fields) is the first one of three possible matches in my worksheet called VMGuests.

Thanks again.

Kind regards,

James
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Sorry for not including tags around my code earlier, I have read the forum rules more closely now!

I also have a sample workbook that I can attach when I have the permission to do so, which I hope will show more clearly what it is I am trying to achieve.

Thanks again for any assistance anyone could offer.

Kind regards,

James
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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