"Year" combobox default - can't get it to show

Montez659

Well-known Member
Joined
May 4, 2005
Messages
918
I have a combobox that will display a list of years to choose. I am not even quite sure of the best way to fill it, but I tried doing it by values and from a table.

Either way, I am not getting it to populate with the current year, which I thought would be a simple
Code:
Me.cmbYear.Value = Year(Date())

I can actually get a month box to populate the correct month using this same method above, but it ain't working for year.

Any suggestions? Thanks in advance!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I think that example will work for me. I am almost sure the problem lies with the fact that a pre-made value list only displayed the integer 2010, 2011, 2012... and not the Year of the date. Same for the table, as I only stored an integer and not a date. Adding the year to the combobox like this obviously fixes the problem.

Thanks guys!
 
Last edited:
Upvote 0
Montez

A year is an integer and as far asI can see the code posted so far is adding the years as integers.

I know mine is, and I think xenou's is too.:)
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,822
Members
452,946
Latest member
JoseDavid

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