|
|
|
||||||||||||
|
|||||||
| Register | FAQ | Forum Rules | FAQ | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Dates as Numbers in Combo Box
I have the same problem as thread, http://www.excelforum.com/excel-prog...ml#post1969271 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
|
|
#2
|
||||
|
||||
|
re: Dates as Numbers in Combo Box
Maybe there is a better way but this works:
Code:
cboGetDate.Text = CLng(Format(cboGetDate.Value, "#######"))
__________________
... and now get outside and enjoy yourself Ave, Ricardo |
|
#3
|
|||
|
|||
|
I have tried this and keep getting a Type Mismatch error on the section
Code:
cboGetDate.Text = CLng(Format(cboGetDate.Value, "dd/mm/yyyy")) Code:
Private Sub cboGetDate_Change()
'cboGetDate.Text = Format(cboGetDate.Text, "dd/mm/yyyy")
cboGetDate.Text = CLng(Format(cboGetDate.Value, "dd/mm/yyyy"))
End Sub
|
|
#4
|
|||
|
|||
|
I have tried this code and still when selecting the dates in the Combo Box they appear as a number format
Code:
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
|
|
#5
|
||||
|
||||
|
Have you tried the hashes #?
__________________
... and now get outside and enjoy yourself Ave, Ricardo |
|
#6
|
||||
|
||||
|
Have you tried DateSerial?
Can you attach the workbook?
__________________
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 |
|
#7
|
|||
|
|||
|
I've tried the Hash's
Attached is the file I'm using to test things out... Its also the same file that the other thread I have open is (Running Stored Procedures from Excel) Thanks |
|
#8
|
|||
|
|||
|
I have tried this code below and it seems to work like it should...
Code:
Private Sub cboGetDate_Change()
MyDate = Format(cboGetDate.Value, "dd/mm/yyyy")
cboGetDate.Value = Format(MyDate, "dd/mm/yyyy")
End Sub
|
![]() |
| Bookmarks |
New topics in Excel Programming
|
|
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Excel keeps converting numbers to dates on copy/paste | zazu88hike | Excel General | 3 | 01-27-2009 01:36 PM |
| dates converting to serial numbers | henro8 | Excel Programming | 1 | 06-24-2008 03:38 PM |
| I need to format various strings (numbers, dates) precisely | durandal05 | Excel Programming | 5 | 06-10-2008 08:55 PM |
| Adding numbers to output dates | MasterMonk | Excel Miscellaneous | 2 | 05-03-2007 04:59 PM |
| Ordinal Numbers in Dates | OfficeBitty | Excel Miscellaneous | 13 | 11-21-2006 04:34 AM |