Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Date Format In Combobox

sI have a Combobox whose RowSource is a list of dates for the current and
last year. When I display the dialog, the Combobox shows the dates as their
values as opposed to January 2007, etc.

Picking up on another thread, I have inserted in the activation code for the
dialog the command:

Me.MonthSelectedBox.Value = Format(Me.MonthSelectedBox, "mmmm yyyy") where
the Combo is called MonthSelectedBox. However, I still get the value.

Thanks in advance for any ideas.

Ian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Date Format In Combobox

It's not crystal clear to me what you mean. If the dates are formatted
in the cells of the RowSource as January 2007, then they appear that
way in the ComboBox when the entire list is shown. However, after
selecting one, such format isn't shown for the selected value. So I
guess that's what you mean. If you want the selected value formatted
in a particular way, then you probably need to not use RowSource and
populate the list like this.

Private Sub UserForm_Activate()
Dim c as Range
ComboBox1.Clear
For Each c In Sheets("Sheet1").Range("A1:A10")
ComboBox1.AddItem Format(c, "mmmm yyyy")
Next c
End Sub

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Date Format In Combobox

The issue is that although the dates are formatted (e.g. as January 2007) in
the cells of the RowSource, when they appear the Combo they are shown as
their date value number.

Having said that, your solution works (thank you!) but, like you, I had
expected the formatting from RowSource to be duplicated in the control.


Ian

"merjet" wrote:

It's not crystal clear to me what you mean. If the dates are formatted
in the cells of the RowSource as January 2007, then they appear that
way in the ComboBox when the entire list is shown. However, after
selecting one, such format isn't shown for the selected value. So I
guess that's what you mean. If you want the selected value formatted
in a particular way, then you probably need to not use RowSource and
populate the list like this.

Private Sub UserForm_Activate()
Dim c as Range
ComboBox1.Clear
For Each c In Sheets("Sheet1").Range("A1:A10")
ComboBox1.AddItem Format(c, "mmmm yyyy")
Next c
End Sub

Hth,
Merjet



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
Format Date ComboBox Blobbies Excel Discussion (Misc queries) 4 January 10th 08 08:40 AM
Combobox Date format change Corey Excel Programming 6 February 4th 07 09:33 AM
Format date in combobox susan Excel Programming 1 September 6th 06 09:56 PM
Combobox/Rowsource - loses date/time format systemx[_14_] Excel Programming 2 July 31st 06 10:24 AM
ComboBox Date Format Problem CiaraG[_5_] Excel Programming 2 February 15th 06 02:17 PM


All times are GMT +1. The time now is 08:24 AM.

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

About Us

"It's about Microsoft Excel"