Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jez Jez is offline
external usenet poster
 
Posts: 38
Default Get a Date to show as a Date Format in Combo Box

I have a combo Box which can select a date but it just displays as the Number
format, I have this code below to change the format but doesnt seem to do
anything when I select a Date it still shows as a number format.
Where have I gone wrong?

Private Sub cboGetDate_Change()
Dim GetDate As Date
If GetDate = CDate(cboGetDate.Value) Then
cboGetDate.Value = Format(CDate(cboGetDate.Value), "dd/mm/yyyy")
Else
End If
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Get a Date to show as a Date Format in Combo Box

What do you think this line is testing against?

If GetDate = CDate(cboGetDate.Value) Then

You haven't assigned anything to the GetDate variable so it doesn't have a
date in it that your ComboBox can be equated to. I'm also not too sure what
your code is supposed to be doing. I presume cboGetDate is the ComboBox..
you are trying to test if the item selected by the user is equal to GetDate
(which, as pointed out above, has nothing in it) and, if it did equal
GetDate, you are trying to format the entry the user selected and put it
back into the ComboBox??? Why aren't you just loading up the ComboBox with
the correct text to begin with? Perhaps you need to provide more detail
about your set up, why it is the way it is and what you are trying to change
about it? Right now, I am confused about what you are trying to do.

--
Rick (MVP - Excel)


"Jez" wrote in message
...
I have a combo Box which can select a date but it just displays as the
Number
format, I have this code below to change the format but doesnt seem to do
anything when I select a Date it still shows as a number format.
Where have I gone wrong?

Private Sub cboGetDate_Change()
Dim GetDate As Date
If GetDate = CDate(cboGetDate.Value) Then
cboGetDate.Value = Format(CDate(cboGetDate.Value), "dd/mm/yyyy")
Else
End If
End Sub


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
I want my combo box to return a date format instead of a number? Cainman Excel Discussion (Misc queries) 2 June 23rd 06 09:29 PM
keep date format in a Combo box t killion Excel Worksheet Functions 1 September 9th 05 05:05 PM
UK date format and combo box L Smith Excel Programming 2 April 24th 05 11:31 AM
Date-Format of Dropdown-Combo is integer goa Excel Programming 1 January 13th 05 11:58 AM
Date format when using combo box Mikey May Excel Programming 1 November 7th 03 12:50 PM


All times are GMT +1. The time now is 01:14 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"