Thread: Userforms.....
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_8_] Nigel[_8_] is offline
external usenet poster
 
Posts: 172
Default Userforms.....

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

"Candee" wrote in message
...

I hope someone can help....

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

The next userform is for editing the records that were entered in the
first one. I have a combobox (cboID) that is linked to the "Log" by
setting the properties of the ControlSource to Log!A1
and RowSource to MasterLog. I need to make it so I can select the drop
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 appear
on the form. This is the code I have (and it works fine in a different
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 particular
workbook, it is not giving me the opportunity to go to the combo box
first to select what I need. I can step through this, it selects the
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've
missed from the working one to the non-working one, but I just can't
see it. I'm hoping that a fresh set of eyes looking at it
will help.

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


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---