Using a drop down option to determine entries in other fields

I heart Excel

Board Regular
Joined
Feb 28, 2011
Messages
66
Hello,

I am creating a form where the user selects their name from a drop down and then this will determine who the Manager is in the neighbouring field.

For example -

In the drop down for User -
A Brown
P Piper
D Someone
Z Walter
K Norman

Manager Field
P Box
S Sugar

The first 3 Users need to have P Box automatically appear in the neighbouring field, and the remaining 2 need to refer to S Sugar.

I know how to create drop downs but can't figure out how to do this.

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hello,

I am creating a form where the user selects their name from a drop down and then this will determine who the Manager is in the neighbouring field.

For example -

In the drop down for User -
A Brown
P Piper
D Someone
Z Walter
K Norman

Manager Field
P Box
S Sugar

The first 3 Users need to have P Box automatically appear in the neighbouring field, and the remaining 2 need to refer to S Sugar.

I know how to create drop downs but can't figure out how to do this.

Thanks


Code:
Application.ScreenUpdating = False
Dim a, i As Long, ii As Long, b(), n As Long
ListBox1.Clear
With ComboBox1
If .Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Worksheets("x").Range("a:a"), .Text) = 0 Then
MsgBox "No Entry !"
ComboBox1 = ("")
Exit Sub
End If
a = Worksheets("x").Range("a1").Resize(Worksheets("x").Range("a" & Rows.Count).End(xlUp).Row, 4).Value
For i = 1 To UBound(a, 1)
If a(i, 1) = .Text Then
n = n + 1: ReDim Preserve b(1 To 4, 1 To n)
For ii = 1 To UBound(a, 2)
b(ii, n) = a(i, ii)
Next
End With
With ListBox1
.ColumnCount = 4
.ColumnWidths = "70;70;70;70"
.Column = b
End With
Application.ScreenUpdating = True

Hi,
Just create on ur userform a listbox with ur combobox nd double click ur combobox then paste that code into it..
That code base on 4 columns ,u can create more or less urself.
Cheers
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top