Userform Stepping Through Sheet Data

T

t2hst

Trying to develop a spreadsheet to do pair-wise comparisons and need
some help on the strategy to implement. Have 10 items in a single
column. Want to compare row 1 with 2, 3, 4...., then row 2 with 3, 4,
5..., then 3 with 4, 5, 6..., etc. I put together a userform that gets
the items and allows you to select a radio button to choose between
each fo the two.

I am struggling with the following:

Want the user to keep pressing a next button on the userform after
making their selection. Each press will write the two items on the
sheet, identify which was selected and then go get the next two items
to compare. Not sure how do do this with an On_Click event for the
button. You have to keep track of the first and second comparison
items, but each time you Click the button, the code starts back at the
top of the subroutine. Do you track the items outside the On_Click and
pass parameters? Any help would be appreciated.

Terry
 
V

Vergel Adriano

You can declare form variables to keep/share values across different
methods/events. For example, the code below will count the number of times a
button is clicked. Hopefully this gives you an idea of what you need to do.

Private iClickCount As Integer

Private Sub CommandButton1_Click()
'increment the count
iClickCount = iClickCount + 1
End Sub
Private Sub UserForm_Initialize()
'initialize the variable
iClickCount = 0
End Sub
 
T

t2hst

You can declare form variables to keep/share values across different
methods/events. For example, the code below will count the number of times a
button is clicked. Hopefully this gives you an idea of what you need to do.

Private iClickCount As Integer

Private Sub CommandButton1_Click()
'increment the count
iClickCount = iClickCount + 1
End Sub
Private Sub UserForm_Initialize()
'initialize the variable
iClickCount = 0
End Sub








- Show quoted text -

Thanks. Got it now.

Terry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top