View Full Version : Solved: Populate UserForm TextBox based on Worksheet Lookup
tccmdr
07-23-2007, 09:36 PM
Hello gurus:bow:
I have a worksheet with Jobtitles in column A and there relevant competencies in columns B to Z for each Jobtitle.
I have a UserForm with a Job Title TextBox and a MultiPage Control with pages 1 to 25. On each MultiPage page I have a TextBox which I want to populate with the relevant competency.
i.e
MultiPage1.TextBox1.Value=lookup jobtitle and return column B content;
MultiPage2.TextBox2.Value=lookup jobtitle and return column C content;
etc...
Any suggestions:dunno
Bob Phillips
07-24-2007, 12:37 AM
Private Sub TextBox1_AfterUpdate()
Dim iRow As Long
With Me
On Error Resume Next
iRow = Application.Match(.TextBox1.Text, Worksheets("Sheet1").Columns(1), 0)
On Error GoTo 0
If iRow > 0 Then
.MultiPage1.Pages(1).TextBox2.Text = Worksheets("Sheet1").Cells(iRow, "B").Value
End If
End With
End Sub
tccmdr
07-24-2007, 04:06 PM
Hello Mr.X:friends:
I used the following code
Private Sub TextBox2_AfterUpdate()
Dim iRow As Long
With Me
On Error Resume Next
iRow = Application.Match(.TextBox1.Text, Worksheets("Competencies").Columns(1), 0)
On Error GoTo 0
If iRow > 0 Then
.MultiPage1.Pages(2).TextBox2.Text = Worksheets("Competencies").Cells(iRow, "B").Value
End If
End With
End Sub
The TextBox is still not populating??:think:
tccmdr
07-24-2007, 11:04 PM
Sorry Mr.X,
I meant
Private Sub TextBox2_AfterUpdate()
:help Nothing is being returned ??
tccmdr
07-24-2007, 11:05 PM
:whistle:
Private Sub TextBox1_AfterUpdate()
tccmdr
07-25-2007, 03:51 AM
Still not populating......
Additionally, if I type in other text I receive an error type 439
"Object not supported by this method or property"
Can anyone help out on this: pray2:
You should just be able to use:
Me.TextBox2.Text = Worksheets("Competencies").Cells(iRow, "B").Value
Regards,
Rory
tccmdr
07-25-2007, 05:05 AM
Thanks Rory,
I'll use your streamlined version...............
but..:doh: I am a drongo
Forgot 1st page of multipage = 0 :giggle
Thanks Mr.X
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.