Format Combo Box

  • Thread starter Thread starter LROCCO
  • Start date Start date
L

LROCCO

Hi, I'm using the following code to look up a range to use for my
combobox list. The range has been formatted as date (dd/mm/yyy).
However, when it appears in the combobox list its shown as m/dd/yyyy.
Can anybody help.

CmBoxStartRange.List = Sheets("lvdtraw").Range("a5",
Sheets("lvdtraw").Range("a5").End(xlDown)).Value
 
Instead of using .list, you could use .additem and format the text the way you want.

cmboxstartrange.list = ""
cmboxstartrange.clear
with Sheets("lvdtraw")
for each myCell in .range("a5"),.Range("a5").End(xlDown)).cells
cmboxstartrange.additem format(mycell.value, "dd/mm/yy")
next mycell
end with

Personally, I'd use a format that was unambiguous -- like "dd-mmm-yyyy".

It scares me to have to guess what the user intended with 01/02/03.

(all untested and uncompiled -- watch for typos!)
 
Instead of using .list, you could use .additem and format the text the way you want.

cmboxstartrange.list = ""
cmboxstartrange.clear
with Sheets("lvdtraw")        
    for each myCell in .range("a5"),.Range("a5").End(xlDown)).cells
        cmboxstartrange.additem format(mycell.value, "dd/mm/yy")
    next mycell
end with

Personally, I'd use a format that was unambiguous -- like "dd-mmm-yyyy".

It scares me to have to guess what the user intended with 01/02/03.

(all untested and uncompiled -- watch for typos!)

Thanks again Dave, work fine
 
Thanks again Dave, work fine- Hide quoted text -

- Show quoted text -

How can this code be modified to only allow dates which are in the
list, i.e. user not allowed to enter their own date?
 
Back
Top