VBA Userform drop down list appears blank

Ge11i

New Member
Joined
Dec 15, 2016
Messages
1
*I’m very new to VB, so I apologise in advance!
I’ve created my first userform for excel, want participants to enter their data, click ‘submit’ and excel will store the data on one of the sheets. Made drop down lists with a combo box, but when the user form opens automatically with the excel document, it the value appear blank? (see below) and is the same for all the boxes on the form.
C:\DOCUME~1\He083659\LOCALS~1\Temp\msohtmlclip1\01\clip_image002.jpg

<tbody>
</tbody>


This is the code I use for the drop down box:
Private Sub UserForm_Activate()
ComboContrib.AddItem 'Consent & Surgical Intervention', 0
ComboContrib.AddItem 'Consent & Patient Care', 1
ComboContrib.AddItem 'Patient Care & Data Aquisition', 2
ComboContrib.AddItem 'Other', 3
End Sub

Any ideas to why this is happening? Thank you.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

GTO

MrExcel MVP
Joined
Dec 9, 2008
Messages
6,155
If your code is as shown, you need double quote marks (rather than single) to indicate a string. A single quote mark (except if inside starting/ending double quote marks) indicates that the rest of the line is a comment and is ignored by the compiler.

Hope that helps,

Mark
 
Upvote 0

Forum statistics

Threads
1,191,119
Messages
5,984,758
Members
439,909
Latest member
daigoku

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
Top