Populate combobox VBA

MM91

Board Regular
Joined
Nov 29, 2021
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Hi I have a very simple gameI am trying to codxe to help learn and I am simply tryinh to populate a combo box. I have seemingly the same code on other userform modules I use and it works fine but this will not populate anything to the combobox no matter what I try. anyone have any tips? thank you!



Option Explicit



Private Sub NewGameUF_Initialize()


Count.List = Array("1", "2", "3", "4", "5", "6", "7", "8")

Name1.Text = test
Name2.Text = test




End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
If Count is the name of your combobox, that might be the problem. You might try a name that is not the same as a common object attribute.

Are you getting an error? Or does nothing happen?
 
Upvote 0
This line is wrong
VBA Code:
Private Sub NewGameUF_Initialize()
it should be
VBA Code:
Private Sub UserForm_Initialize()
regardless of what the userform is called.
 
Upvote 0
Solution
wow thank you so much! pretty much the only thing I didnt consider I was so concerend about the code. thank you!!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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