Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 09-08-2007, 11:42 AM
ions ions is offline
Registered User
 
Join Date: 06 Oct 2006
Posts: 75
ions is becoming part of the community
Dates as Numbers in Combo Box

Please Register to Remove these Ads

Dear Excel Expert

My combo box has a ListFillRange (Record Source) made up of Dates. When I select a date from the combo Box it converts it to a number 39325. I want the date to appear 01/09/2007 instead of 39325 but I coulnd't locat a data type property in the combo box.

Thanks so much.

I appreciate your help.

Peter.

Last edited by ions; 09-08-2007 at 05:01 PM.
Reply With Quote
  #2  
Old 09-08-2007, 01:03 PM
Leith Ross's Avatar
Leith Ross Leith Ross is online now
Forum Moderator
 
Join Date: 15 Jan 2005
Location: San Francisco, Ca
MS Office Version:2000, 2003, & read 2007
Posts: 10,537
Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding Leith Ross Has a higher level of understanding
Send a message via AIM to Leith Ross
Hello Peter,

Did you mean to post an Access question in an Excel programming group?

Sincerely,
Leith Ross
Reply With Quote
  #3  
Old 09-08-2007, 01:08 PM
royUK's Avatar
royUK royUK is online now
Forums Administrator
 
Join Date: 18 Nov 2003
Location: Derbyshire,UK
MS Office Version:Xp; 2007
Posts: 13,802
royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding
That is how Excel stores dates, have you got your cells correctly formatted as dates?
__________________
Hope that helps.

RoyUK
--------
If you are pleased with a member's answer then use the Scales icon to rate it

For Excel consulting, free examples and tutorials visit my site
Check out the free Excel Toolbar

New members please read & follow the Forum Rules

Remember to mark your questions Solved and rate the answer(s)


Code Tags: Make your code easier for us to read
Reply With Quote
  #4  
Old 09-08-2007, 01:30 PM
Paul's Avatar
Paul Paul is offline
Forum Moderator
 
Join Date: 05 Feb 2007
Location: Wisconsin, U.S.A.
MS Office Version:2007
Posts: 3,882
Paul is very confident of their ability Paul is very confident of their ability Paul is very confident of their ability Paul is very confident of their ability Paul is very confident of their ability
To get it to show properly, you could probably set the combobox's change event to something like:
Code:
Private Sub ComboBox1_Change()
    ComboBox1.Text = Format(ComboBox1.Text, "m/d/yyyy")
End Sub
__________________
- Paul

Click here to read the Forum Rules

To give a virtual "pat on the back" click the icon in the gray toolbar from that user's post.
To report abuse, spam or offensive posts, please click the icon.
Reply With Quote
  #5  
Old 09-08-2007, 05:09 PM
ions ions is offline
Registered User
 
Join Date: 06 Oct 2006
Posts: 75
ions is becoming part of the community
Hi pjoaguin

thanks for your suggestion ... I tried with and without the text suffix (Me.endDate.text / Me.endDate ) but I get the following errors.

"Could not set the Text property value. Invalid property value"

"Could not set the Value property value. Invalid property value"
Reply With Quote
  #6  
Old 09-08-2007, 06:00 PM
Paul's Avatar
Paul Paul is offline
Forum Moderator
 
Join Date: 05 Feb 2007
Location: Wisconsin, U.S.A.
MS Office Version:2007
Posts: 3,882
Paul is very confident of their ability Paul is very confident of their ability Paul is very confident of their ability Paul is very confident of their ability Paul is very confident of their ability
Hi ions,

If you are using Excel (and not Access), can you post an example of your worksheet and what you're trying to do?

I notice the "Me.endDate...", does that mean your combobox is on a userform?

Thanks.
__________________
- Paul

Click here to read the Forum Rules

To give a virtual "pat on the back" click the icon in the gray toolbar from that user's post.
To report abuse, spam or offensive posts, please click the icon.
Reply With Quote
  #7  
Old 09-08-2007, 09:04 PM
ions ions is offline
Registered User
 
Join Date: 06 Oct 2006
Posts: 75
ions is becoming part of the community
Hi Pjiaguin

I figured it out.... (I did it using VBA) what I originally did was place a combo box on the Worksheet... (no I didn't use a Userform I used the Me to refer to the Worksheet)

Originally, I referenced cells to act as the ListContents (Row Source) for the combo box. The cells were Formated as Dates. The reason I had them as dates was because the cells were dynamic. They were using the Date Function and I couldn't hard code them as text.

The problem was that once I selected a date in the drop down the Excel date Cell number appeared instead of the Date format.

I couldn't get around this so what I did was fill the cell contents using VBA and the cString.

Range("T1") = cString(Date - 7) This way my cells were dynamic but formated as text. Now when I select from the drop down the correct format appears in the control and not the Excel Date number.

It's just puzzling how Excel has this problem and that I had to do it Using VBA. I am surprised there isn't a way to do it without VBA

Thanks for all your advice I appreciate it. You lead me in the right direction by directing me to use VBA.

thanks pjaiguin
Reply With Quote
  #8  
Old 09-09-2007, 03:37 AM
royUK's Avatar
royUK royUK is online now
Forums Administrator
 
Join Date: 18 Nov 2003
Location: Derbyshire,UK
MS Office Version:Xp; 2007
Posts: 13,802
royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding royUK Has a higher level of understanding
Using a combox with dates inputted manually shouldn't have a problem, nor do I get the same rsult when using a formula to create the dates.
__________________
Hope that helps.

RoyUK
--------
If you are pleased with a member's answer then use the Scales icon to rate it

For Excel consulting, free examples and tutorials visit my site
Check out the free Excel Toolbar

New members please read & follow the Forum Rules

Remember to mark your questions Solved and rate the answer(s)


Code Tags: Make your code easier for us to read
Reply With Quote
  #9  
Old 09-17-2008, 10:55 AM
JezLisle JezLisle is offline
Forum Contributor
 
Join Date: 06 Jun 2008
Location: Manchester
MS Office Version:MS Office 2003
Posts: 143
JezLisle is becoming part of the community
I have the same problem, when I fill the Combo Box it shows as a date in the list for selecting in the Combo Box. Once I select the Date I want it then changes back t its number format. I have tried using the code below and still no joy, where am I going wrong?
Code:
Private Sub cboGetDate_Change()
    cboGetDate.Text = Format(cboGetDate.Text, "dd/mm/yyyy")
End Sub
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump