#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Date Format

Hi,
I have a combobox displaying a range of available dates in the format
dd/mm/yy. Once selected the date should display in the combobox.
Unfortunately once selected the date displays in numeric. Is there a method
to have the combobox maintain the date format?

Your help is really appreciated.
Mickey


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Date Format

Private Sub ComboBox1_Change()
ComboBox1.Value = Format(ComboBox1.Value, "DD/MM/YY")
End Sub

"MBlake" wrote:

Hi,
I have a combobox displaying a range of available dates in the format
dd/mm/yy. Once selected the date should display in the combobox.
Unfortunately once selected the date displays in numeric. Is there a method
to have the combobox maintain the date format?

Your help is really appreciated.
Mickey



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Date Format

Hi Toppers,
Brilliant!, I've been looking at that for a few days and got nowhere. I am
very grateful for your help. Is it now possible to transfer the date
dd/mm/yy to four text boxes day/datemonth/year so that when a user enter the
date, the textboxes change to - for example - Mon/15/Apr/05. Again I can do
this in the worksheet but how do I accomplish it on a user form?

Mickey


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Date Format

Hi,

Private Sub ComboBox1_Change()

Weekdays = Array("Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat)

ComboBox1.Value = Format(ComboBox1.Value, "DD/MMM/YY")

myweekday = Weekdays(Weekday(ComboBox1.Value) - 1)

TextBox1.value = myweekday & "/" & ComboBox1.Value
TextBox2.value = myweekday & "/" & ComboBox1.Value
.....

End Sub

HTH

"MBlake" wrote:

Hi Toppers,
Brilliant!, I've been looking at that for a few days and got nowhere. I am
very grateful for your help. Is it now possible to transfer the date
dd/mm/yy to four text boxes day/datemonth/year so that when a user enter the
date, the textboxes change to - for example - Mon/15/Apr/05. Again I can do
this in the worksheet but how do I accomplish it on a user form?

Mickey



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Date Format

Cheers Toppers,
I'm getting a 'variable not defined' error and the line 'Weekdays=Array etc
is highlighted. I'll take a look and see if I can figure it out.

Cheers for your help, very much appreciated,
Mickey


"Toppers" wrote in message
...
Hi,

Private Sub ComboBox1_Change()

Weekdays = Array("Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat)

ComboBox1.Value = Format(ComboBox1.Value, "DD/MMM/YY")

myweekday = Weekdays(Weekday(ComboBox1.Value) - 1)

TextBox1.value = myweekday & "/" & ComboBox1.Value
TextBox2.value = myweekday & "/" & ComboBox1.Value
....

End Sub

HTH

"MBlake" wrote:

Hi Toppers,
Brilliant!, I've been looking at that for a few days and got nowhere. I
am
very grateful for your help. Is it now possible to transfer the date
dd/mm/yy to four text boxes day/datemonth/year so that when a user enter
the
date, the textboxes change to - for example - Mon/15/Apr/05. Again I can
do
this in the worksheet but how do I accomplish it on a user form?

Mickey







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Date Format

You need to declare the variables before you use them. E.g.,

Dim Weekdays As Variant
Dim MyWeekday As Variant


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"MBlake" wrote in message
...
Cheers Toppers,
I'm getting a 'variable not defined' error and the line
'Weekdays=Array etc is highlighted. I'll take a look and see
if I can figure it out.

Cheers for your help, very much appreciated,
Mickey


"Toppers" wrote in message
...
Hi,

Private Sub ComboBox1_Change()

Weekdays = Array("Sun","Mon", "Tue", "Wed", "Thu", "Fri",
"Sat)

ComboBox1.Value = Format(ComboBox1.Value, "DD/MMM/YY")

myweekday = Weekdays(Weekday(ComboBox1.Value) - 1)

TextBox1.value = myweekday & "/" & ComboBox1.Value
TextBox2.value = myweekday & "/" & ComboBox1.Value
....

End Sub

HTH

"MBlake" wrote:

Hi Toppers,
Brilliant!, I've been looking at that for a few days and got
nowhere. I am
very grateful for your help. Is it now possible to transfer
the date
dd/mm/yy to four text boxes day/datemonth/year so that when a
user enter the
date, the textboxes change to - for example - Mon/15/Apr/05.
Again I can do
this in the worksheet but how do I accomplish it on a user
form?

Mickey







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Date Format

Sorry about the variable declarations - I hadn't set Option Explicit when I
tested it. Hope it is OK now .. and thank you Chip.

"MBlake" wrote:

Cheers Toppers,
I'm getting a 'variable not defined' error and the line 'Weekdays=Array etc
is highlighted. I'll take a look and see if I can figure it out.

Cheers for your help, very much appreciated,
Mickey


"Toppers" wrote in message
...
Hi,

Private Sub ComboBox1_Change()

Weekdays = Array("Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat)

ComboBox1.Value = Format(ComboBox1.Value, "DD/MMM/YY")

myweekday = Weekdays(Weekday(ComboBox1.Value) - 1)

TextBox1.value = myweekday & "/" & ComboBox1.Value
TextBox2.value = myweekday & "/" & ComboBox1.Value
....

End Sub

HTH

"MBlake" wrote:

Hi Toppers,
Brilliant!, I've been looking at that for a few days and got nowhere. I
am
very grateful for your help. Is it now possible to transfer the date
dd/mm/yy to four text boxes day/datemonth/year so that when a user enter
the
date, the textboxes change to - for example - Mon/15/Apr/05. Again I can
do
this in the worksheet but how do I accomplish it on a user form?

Mickey






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Date Format

Cheers Toppers,
It all works very well,

Mickey


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
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
How do I convert dd/mm/yy date format to yyddd Julian date format itzy bitzy[_2_] Excel Worksheet Functions 8 December 11th 09 03:20 AM
change date format dd/mm/yyyy to Julian date format? itzy bitzy Excel Worksheet Functions 1 December 8th 09 07:42 PM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


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