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?
Private Sub cboGetDate_Change() cboGetDate.Text = Format(cboGetDate.Text, "dd/mm/yyyy") End Sub
Maybe there is a better way but this works:
cboGetDate.Text = CLng(Format(cboGetDate.Value, "#######"))
Looking for great solutions but hate waiting?
Seach this Forum through Google
www.Google.com (e.g. +multiple +IF site:excelforum.com/excel-general/ )
www.Google.com (e.g. +fill +combobox site:excelforum.com/excel-programming/ )
Ave,
Ricardo
I have tried this and keep getting a Type Mismatch error on the section
When I hover over it on the Debug it shows me the date as a number stillcboGetDate.Text = CLng(Format(cboGetDate.Value, "dd/mm/yyyy"))
Where am I going wrong?Private Sub cboGetDate_Change() 'cboGetDate.Text = Format(cboGetDate.Text, "dd/mm/yyyy") cboGetDate.Text = CLng(Format(cboGetDate.Value, "dd/mm/yyyy")) End Sub
I have tried this code and still when selecting the dates in the Combo Box they appear as a number format
I cant see where am going 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
Have you tried the hashes #?
Looking for great solutions but hate waiting?
Seach this Forum through Google
www.Google.com (e.g. +multiple +IF site:excelforum.com/excel-general/ )
www.Google.com (e.g. +fill +combobox site:excelforum.com/excel-programming/ )
Ave,
Ricardo
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 Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
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
I have tried this code below and it seems to work like it should...
Private Sub cboGetDate_Change() MyDate = Format(cboGetDate.Value, "dd/mm/yyyy") cboGetDate.Value = Format(MyDate, "dd/mm/yyyy") End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks