Userforms.....

C

Candee

I hope someone can help....

I have a worksheet that has multiple userforms with it. One in a
entry form where the user enters tool information, and when the sav
button is clicked, saves the info to a worksheet "Log" with a name
range "MasterLog" which is the entire sheet. This one works great.

The next userform is for editing the records that were entered in th
first one. I have a combobox (cboID) that is linked to the "Log" b
setting the properties of the ControlSource to Log!A1
and RowSource to MasterLog. I need to make it so I can select the dro
down and see all the records that have been entered (approx. 650)
select the one I need and have it refresh to the textboxes that appea
on the form. This is the code I have (and it works fine in a differen
workbook):

Private Sub UserForm_Initialize()

'Open Log where records are stored
ActiveWorkbook.Sheets("Log").Activate
Range("A2").Select


'Find selected record and pull it to the form
Do
If cboID <> ActiveCell Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until cboID = ActiveCell

txtEquip.Value = ActiveCell.Offset(0, 1)
txtLoc.Value = ActiveCell.Offset(0, 6)
txtEmp.Value = ActiveCell.Offset(0, 7)
txtRecall.Value = ActiveCell.Offset(0, 9)
txtStatus.Value = ActiveCell.Offset(0, 10)

'Set up new entry boxes

txtLoc2.Value = txtLoc.Value
txtEmp2.Value = txtEmp.Value
txtCertDate.Value = txtRecall.Value
txtStatus2.Value = txtStatus.Value
txtComments.Value = "N/A"

End Sub

The problem I'm having is that when I run the form in this particula
workbook, it is not giving me the opportunity to go to the combo bo
first to select what I need. I can step through this, it selects th
worksheet and cell okay, but then just loops (and loops and loops
through all 65000+ rows and gives an error.

I have tried comparing the two codes side by side looking for what I'v
missed from the working one to the non-working one, but I just can'
see it. :confused: I'm hoping that a fresh set of eyes looking at i
will help.

Thanks in advance to anyone who may be able to help me out, and have
great day
 
N

Nigel

It looks as if the line that tests if the cboID <> ActiveCell is not finding
a match. Try using the value property of the cboID in the test.

If cboID.Value <> ActiveCell Then

etc...


Cheers
N
 

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