Hello again,
I have built a UserForm (Excel 2003) that looks up a Row dependant on Criteria and displays the values on the User Form. See Below
The UserForm then runs the following.![]()
Private Sub UserForm_Initialize() If Worksheets("Main Sheet").Range("E7") = ActiceCell Then RowNumber = 4 If Worksheets("Main Sheet").Range("E8") = ActiveCell Then RowNumber = 5 If Worksheets("Main Sheet").Range("E9") = ActiveCell Then RowNumber = 6 If Worksheets("Main Sheet").Range("E10") = ActiveCell Then RowNumber = 7 If Worksheets("Main Sheet").Range("E11") = ActiveCell Then RowNumber = 8 If Worksheets("Main Sheet").Range("E12") = ActiveCell Then RowNumber = 9 If Worksheets("Main Sheet").Range("E13") = ActiveCell Then RowNumber = 10 If Worksheets("Main Sheet").Range("E14") = ActiveCell Then RowNumber = 11 If Worksheets("Main Sheet").Range("E15") = ActiveCell Then RowNumber = 12 If Worksheets("Main Sheet").Range("E16") = ActiveCell Then RowNumber = 13 Worksheets("Sheet1").Select GetData End Sub
The problem I'm having is that when running through the processes step by step it all works perfectly![]()
Private Sub GetData() Dim r As Long If IsNumeric(RowNumber.Text) Then r = CLng(RowNumber.Text) Else ClearData MsgBox "You have reached the Maximum" Exit Sub End If If r > 3 And r <= 35 Then TextBox1.Text = Cells(r, 1) TextBox2.Text = Cells(r, 2) TextBox3.Text = Cells(r, 3) TextBox4.Text = Cells(r, 4) TextBox5.Text = Cells(r, 5) TextBox6.Text = Cells(r, 6) TextBox7.Text = Cells(r, 7) TextBox8.Text = Cells(r, 8) TextBox9.Text = Cells(r, 9) TextBox10.Text = Cells(r, 10) TextBox11.Text = Cells(r, 11) TextBox12.Text = Cells(r, 12) TextBox13.Text = Cells(r, 13) ElseIf r = 3 Then ClearData MsgBox "You have reached the Maximum" End If End Subbut when actualy running from a command button, its like it is to fast for it and the UserForm either does not display all the details or is a mixture of the current and previous Rows details.
Does anyone know why or how to remedy this?
Regards











LinkBack URL
About LinkBacks
but when actualy running from a command button, its like it is to fast for it and the UserForm either does not display all the details or is a mixture of the current and previous Rows details. 
Register To Reply
Bookmarks