ComboBox Dates

deepheat101

Board Regular
Joined
Jul 26, 2006
Messages
138
Hi All...

I need all the drop down items (dates) within a ComboBox on a form to appear in the format dd-Mmm-yyyy. The source range is in the required format. I would have thought that the ComboBox would be populated using the following...

Code:
    ComboBox1.List = Format(Range("F18:F" & LastRow).Value, "dd-Mmm-yyyy")

...but, obviously, this does not work. Anyone care to offer a suggestion?

Many Thanks

Dave
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try:

ComboBox1.RowSource = Range("F18:F" & LastRow).Address(0,0)

Make sure the right sheet is the ActiveSheet though.
 
Upvote 0
I'm not sure how to get Format() to accept and return a range.

You can always throw it into a loop:
<hr>
Code:
For Each cell In Range("F18:F" & LastRow)
    ComboBox1.AddItem Format(cell, "dd-Mmm-yyyy")
Next cell

-Tim
 
Upvote 0
Peeps - many thanks - both suggestions do the job! However, (for those that stumble across this solution later), tmcfadden's returns the selected date in the date format - rather than a number.

Many Thanks again.
 
Upvote 0

Forum statistics

Threads
1,213,585
Messages
6,114,516
Members
448,575
Latest member
hycrow

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