ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date format in userform (https://www.excelbanter.com/excel-programming/345774-date-format-userform.html)

cutsygurl

Date format in userform
 

I have a userform with a combobox that has dates that you can choose
from. The list of dates look correct but when you choose a date it
changes to the general number on the form. How can I change it so when
you choose the date it still looks like a date???


--
cutsygurl
------------------------------------------------------------------------
cutsygurl's Profile: http://www.excelforum.com/member.php...o&userid=15041
View this thread: http://www.excelforum.com/showthread...hreadid=485635


K Dales[_2_]

Date format in userform
 
That is rather unfortunate, isn't it? I have a workaround, but it only works
if the Combobox.MatchRequired property is False: In the Combobox_Change
event code, put code like this:

Private Sub ComboBox1_Change()

ComboBox1.Text = Format(ComboBox1.Value, "mm/dd/yyyy")

End Sub

--
- K Dales


"cutsygurl" wrote:


I have a userform with a combobox that has dates that you can choose
from. The list of dates look correct but when you choose a date it
changes to the general number on the form. How can I change it so when
you choose the date it still looks like a date???


--
cutsygurl
------------------------------------------------------------------------
cutsygurl's Profile: http://www.excelforum.com/member.php...o&userid=15041
View this thread: http://www.excelforum.com/showthread...hreadid=485635



CiaraG[_5_]

Date format in userform
 
Hi, I have been experiencing the same problems with dates. I have a combo
box on a user form that links to a column on a worksheet containing a list of
dates. When I click on the combo box a list of dates in the correct format
appear. However, when I select a date it appears as a text field,

I tried inserting the code as described below but I haven't had any luck.
Has anybody any other ideas??

"K Dales" wrote:

That is rather unfortunate, isn't it? I have a workaround, but it only works
if the Combobox.MatchRequired property is False: In the Combobox_Change
event code, put code like this:

Private Sub ComboBox1_Change()

ComboBox1.Text = Format(ComboBox1.Value, "mm/dd/yyyy")

End Sub

--
- K Dales


"cutsygurl" wrote:


I have a userform with a combobox that has dates that you can choose
from. The list of dates look correct but when you choose a date it
changes to the general number on the form. How can I change it so when
you choose the date it still looks like a date???


--
cutsygurl
------------------------------------------------------------------------
cutsygurl's Profile: http://www.excelforum.com/member.php...o&userid=15041
View this thread: http://www.excelforum.com/showthread...hreadid=485635



hellZg8

Date format in userform
 
check your code

yours = ComboBox1.Text = Format(ComboBox1.Value, "mm/dd/yyyy")
should be = ComboBox1.Value = Format(ComboBox1.Value, "mm/dd/yyyy")


"CiaraG" wrote:

Hi, I have been experiencing the same problems with dates. I have a combo
box on a user form that links to a column on a worksheet containing a list of
dates. When I click on the combo box a list of dates in the correct format
appear. However, when I select a date it appears as a text field,

I tried inserting the code as described below but I haven't had any luck.
Has anybody any other ideas??

"K Dales" wrote:

That is rather unfortunate, isn't it? I have a workaround, but it only works
if the Combobox.MatchRequired property is False: In the Combobox_Change
event code, put code like this:

Private Sub ComboBox1_Change()

ComboBox1.Text = Format(ComboBox1.Value, "mm/dd/yyyy")

End Sub

--
- K Dales


"cutsygurl" wrote:


I have a userform with a combobox that has dates that you can choose
from. The list of dates look correct but when you choose a date it
changes to the general number on the form. How can I change it so when
you choose the date it still looks like a date???


--
cutsygurl
------------------------------------------------------------------------
cutsygurl's Profile: http://www.excelforum.com/member.php...o&userid=15041
View this thread: http://www.excelforum.com/showthread...hreadid=485635




All times are GMT +1. The time now is 09:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com