adding items into 3 combo boxes on same userform error as 2 different sheets

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi i have a userform with 3 drop down boxes, i want to colate the date from 2 different sheets i have used the code below but i keep getting an error, please can you help, the ComboBox1 and CARRBox the data is collected from the same sheet (IN DAY LISTS) but for MTBox the data is another sheet called (FTE Search). I apprecaite your help on this :) thank you
Code:
 Private Sub UserForm_Initialize()
With Sheets("IN DAY LISTS")
    ComboBox1.RowSource = ""
    ComboBox1.List = .Range("F2:F" & .Range("F" & Rows.Count).End(xlUp).Row).Value
    CARRBox.RowSource = ""
    CARRBox.List = .Range("A2:A" & .Range("A" & Rows.Count).End(xlUp).Row).Value
With Sheets("FTE Search")
    MTBox.RowSource = ""
    MTBox.List = .Range("A2:A" & .Range("A" & Rows.Count).End(xlUp).Row).Value
End With
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi,
you don't say what the error is but looking at your code you are missing an End With statement

Rich (BB code):
Private Sub UserForm_Initialize()


With Sheets("IN DAY LISTS")
    ComboBox1.RowSource = ""
    ComboBox1.List = .Range("F2:F" & .Range("F" & Rows.Count).End(xlUp).Row).Value
    CARRBox.RowSource = ""
    CARRBox.List = .Range("A2:A" & .Range("A" & Rows.Count).End(xlUp).Row).Value
End With


With Sheets("FTE Search")
    MTBox.RowSource = ""
    MTBox.List = .Range("A2:A" & .Range("A" & Rows.Count).End(xlUp).Row).Value
End With


End Sub

see if this solves your problem

Dave
 
Upvote 0
thats great thank you all sorted now :) much appreciated with your help.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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