Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default change format of dropdown list in combo box

For a combo box, I am building a list of dates for the last 365 days
using a loop. This date is in "mm/dd/yyyy" format by default. I want
to display this list in "dd/mmm/yyyy" format when the user clicks on
the drop down.

For this i'm using the code:

Private Sub cmbDateOfTimeLimit_Change()
cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
End Sub
This is because if I use

cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
in the userform_initialize() event it does not change anything....

However when i use the code in combobox_change() it displays the date
in "dd/mmm/yyyy" format only after the date is selected. In the drop
down it still shows in the old format.


Can someone plz help me 2 get rid if this issue..

Thanks in advance,
Yash

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default change format of dropdown list in combo box

Try the Combobox_Select option instead of _Change

Corey....
wrote in message oups.com...
For a combo box, I am building a list of dates for the last 365 days
using a loop. This date is in "mm/dd/yyyy" format by default. I want
to display this list in "dd/mmm/yyyy" format when the user clicks on
the drop down.

For this i'm using the code:

Private Sub cmbDateOfTimeLimit_Change()
cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
End Sub
This is because if I use

cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
in the userform_initialize() event it does not change anything....

However when i use the code in combobox_change() it displays the date
in "dd/mmm/yyyy" format only after the date is selected. In the drop
down it still shows in the old format.


Can someone plz help me 2 get rid if this issue..

Thanks in advance,
Yash


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default change format of dropdown list in combo box

On Jun 15, 10:09 am, "Corey" wrote:
Try the Combobox_Select option instead of _Change

wrote in ooglegroups.com...

For a combo box, I am building a list of dates for the last 365 days
using a loop. This date is in "mm/dd/yyyy" format by default. I want
to display this list in "dd/mmm/yyyy" format when the user clicks on
the drop down.

For this i'm using the code:

Private Sub cmbDateOfTimeLimit_Change()
cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
End Sub
This is because if I use

cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
in the userform_initialize() event it does not change anything....

However when i use the code in combobox_change() it displays the date
in "dd/mmm/yyyy" format only after the date is selected. In the drop
down it still shows in the old format.

Can someone plz help me 2 get rid if this issue..

Thanks in advance,
Yash


doesn't work :-)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default change format of dropdown list in combo box

what about using this in the Combobox1_Select :
Combobox1.value = Format(Combobox1.value,"dd/mmmm/yyyy") ?


wrote in message oups.com...
On Jun 15, 10:09 am, "Corey" wrote:
Try the Combobox_Select option instead of _Change

wrote in
ooglegroups.com...

For a combo box, I am building a list of dates for the last 365 days
using a loop. This date is in "mm/dd/yyyy" format by default. I want
to display this list in "dd/mmm/yyyy" format when the user clicks on
the drop down.

For this i'm using the code:

Private Sub cmbDateOfTimeLimit_Change()
cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
End Sub
This is because if I use

cmbDateOfTimeLimit.Value = Format(cmbDateOfTimeLimit.Value, "dd/
mmm/yyyy")
in the userform_initialize() event it does not change anything....

However when i use the code in combobox_change() it displays the date
in "dd/mmm/yyyy" format only after the date is selected. In the drop
down it still shows in the old format.

Can someone plz help me 2 get rid if this issue..

Thanks in advance,
Yash


doesn't work :-)


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default change format of dropdown list in combo box

doesn't work :-)

Give this UserForm Initialize event code a try...

Private Sub UserForm_Initialize()
Dim X As Date
For X = Now - 365 To Now
ComboBox1.AddItem Format$(X, "dd/mmm/yyyy")
Next
End Sub

Nothing for you to do after this... the list will display as you wanted.

Rick


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default change format of dropdown list in combo box

doesn't work :-)

Give this UserForm Initialize event code a try...

Private Sub UserForm_Initialize()
Dim X As Date
For X = Now - 365 To Now
ComboBox1.AddItem Format$(X, "dd/mmm/yyyy")
Next
End Sub

Nothing for you to do after this... the list will display as you wanted.


Of course, you would use your ComboBox's Name instead of ComboBox1 like I
did.

Rick

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
combo box dropdown list pczmut Excel Worksheet Functions 0 June 29th 06 03:12 PM
Combo Box List Dropdown HornJM Excel Programming 1 May 15th 06 10:11 PM
Date-Format of Dropdown-Combo is integer goa Excel Programming 1 January 13th 05 11:58 AM
Change and update contents of a dropdown combo .... Mark Rosenkrantz[_3_] Excel Programming 0 July 12th 04 10:13 AM
XL97:Combo/DropDown box and Not In List nick42 Excel Programming 1 February 2nd 04 06:33 PM


All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"