Columnbound?

rahul25

New Member
Joined
Nov 18, 2005
Messages
8
I created a multipage userform in excel VBA.

userform Page 1 for info data entry
excel sheet sample below

A B C D
Name Age case# file#
1 Mr. x 27 2345 5677
2 Ms. Y 49 2356 5678

userform Page 2 for number of hours worked entry:

Name :Combobox stating row source A1:D2
Age : label 1
Case#: label2
File#: label3
Hours : will type in>

My question is , if I select a name in combobox in userform page 2 , how it is possible to display corresponding data in label 1 , label 2 and label 2 automatically.

Please help.
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

One way is with a combobox_change event.

Code:
Private Sub ComboBox1_Change()
 Label1.Caption = WorksheetFunction.VLookup(ComboBox1.Value, Range("a1:d3"), 2, False)
 Label2.Caption = WorksheetFunction.VLookup(ComboBox1.Value, Range("a1:d3"), 3, False)
 Label3.Caption = WorksheetFunction.VLookup(ComboBox1.Value, Range("a1:d3"), 4, False)
End Sub

Update ranges, values, names etc as required.

HTH

Tony
 

Watch MrExcel Video

Forum statistics

Threads
1,118,530
Messages
5,572,686
Members
412,481
Latest member
nhantam
Top