Userform text & combobox population help required please

  • Thread starter Thread starter Newbie1
  • Start date Start date
N

Newbie1

Help Im stuck again!!!

I am using a userform to enter details into cells to create an Excel
database.
Clicking a commandbutton enters the details from the boxes into the next
available row of the database. During this process column A of the row is
given a number.

I would like to be able to "re-use" the userform to recall any individual
row by the given number.
E.G. Enter the number into a textbox and the other text boxes of the
userform are re-populated with the other details from the row ---If that
makes sense!

I hope somebody can understand and offer some help

Thanks

Kenny
 
instead of

Cells(i,3).Value = Textbox3.text

do

Textbox3.Text = cells(clng(Textbox1.Text),3)

I assume you would have a separate button on the userform to retrieve data.
 
Hello Tom

You are way above me!
I am not sure of what I am doing here.
I ran the code -

Sub IdentRetrieve()
TextBox2.Text = Cells(CLng(TextBox1.Text),2)
End Sub

- from a button on the userform however I got Runtime Error '424' Object
Required

What is wrong?
The userform is still displayed on the screen but has not been updated

Am I correct is presuming the line of code means (in laymens terms)
Use the text in TextBox2 {24}
Find the cell containing this value {column A Row 25}
Get the value of the cell in column B - same row {because of the ,2}
Put this value into TextBox1

I am using Win Me and Office 2000

Kenny
 
assume Textbox1.Text holds the row number you are working in {25}

Textbox2.Text = Cells(25,2).Value

so you basically describe it correctly except the value in B25 is placed in
Textbox2.
 
Sorry to trouble you again Tom but this code does not work

I am still getting runtime error '424' Object required

As I may have been mixed up with my TextBoxes I swapped them about but still
keep getting the error.

Also I think I am confusing the issue with Row numbers and numbers in column
A Would this cause the problem.?

A brief run through again -

Userform1contains several text boxes and is used to enter details into the
Excel database.

Textbox 1 enters details into column B of the next available row
Textbox 3 enters details into column C of the same row
Textbox 6 enters details into column D of the same row

Column A of this row is automatically given a number (call it an ID number)
this does not match the row number.

several entries later....

I call userform1 and enter one of the ID numbers into textbox 2

On clicking a button to run the code I require. The other textboxes are to
be populated with the info as entered earlier.

I know it is basically a lookup but I am really stuck

Could you help further

Kenny
 
Hello

It looks as though my thread is dead!
If anyone picks it up at a later date I eventually got toms code to work -
Only by specifying the userform
i.e. Userform1.TextBox1
However his code still looked at row numbers not the numbers in column A
I used;-

ans = UserForm1.TextBox2.Value
res = Application.Match(CLng(ans), Range("A2:A3000"), 0)
Range("A2:A3000")(res).Activate

to locate the correct row then used

UserForm1.TextBox1.Text = ActiveCell.Offset(0, 1).Value
UserForm1.ComboBox1.Value = ActiveCell.Offset(0, 2).Value
UserForm1.ComboBox2.Value = ActiveCell.Offset(0, 3).Value

to populate the textboxes

Hope that is useful to other readers

Kenny
 
Back
Top