Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Date Value in wrong format on userform

I have a textbox that displays the value of a cell(E2), but the worksheet displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October 2006) ?


Corey....
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Corey,

Try:

'=============
Private Sub UserForm_Initialize()
Me.TextBox1.Value = _
Format(Range("E2").Value, "dd/mm/yy")
End Sub
'<<=============


---
Regards,
Norman



"Corey" wrote in message
...
I have a textbox that displays the value of a cell(E2), but the worksheet
displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October
2006) ?


Corey....


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Corey,

Or, more consistent with your indicated format:

'=============
Private Sub UserForm_Initialize()
Me.TextBox1.Value = _
Format(Range("E2").Value, "dd mmmm yyyy")
End Sub
'<<=============



---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Date Value in wrong format on userform

Me.TextBox1.Value = _
Format(Range("E2").Value, "dd/mmmm/yy")


This format returns the month as October!

Regards,
Stefi

€˛Norman Jones€¯ ezt Ć*rta:

Hi Corey,

Try:

'=============
Private Sub UserForm_Initialize()
Me.TextBox1.Value = _
Format(Range("E2").Value, "dd/mm/yy")
End Sub
'<<=============


---
Regards,
Norman



"Corey" wrote in message
...
I have a textbox that displays the value of a cell(E2), but the worksheet
displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October
2006) ?


Corey....



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Steffi,

This format returns the month as October!


Indeed! As does my last post!


---
Regards,
Norman




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Date Value in wrong format on userform

thanks for the reply Norman

I now can get 31/10/06 instead of 10/31/06,
But my aim is for "31 October 2006"

I tried changing the .value to .text but no go.
Any idea's

ctm
"Norman Jones" wrote in message
...
Hi Corey,

Try:

'=============
Private Sub UserForm_Initialize()
Me.TextBox1.Value = _
Format(Range("E2").Value, "dd/mm/yy")
End Sub
'<<=============


---
Regards,
Norman



"Corey" wrote in message
...
I have a textbox that displays the value of a cell(E2), but the worksheet
displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October
2006) ?


Corey....



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Date Value in wrong format on userform

Ina ctual fact i am now geting what i originally had.
I read you other post and tried:

Private Sub UserForm_Initialize()
Me.TextBox1.Value = _
Format(Range("E2").Value, "dd/mm/yy")
End Sub

And placed this in the userform code
Is that where is belongs?

I do not get any change in the textbox apperanace ????

Is there somehting i need to change in the textbox properties also ??

I have it linked to cell E2.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Corey,

Ina ctual fact i am now geting what i originally had.
I read you other post and tried:

Private Sub UserForm_Initialize()
Me.TextBox1.Value = _
Format(Range("E2").Value, "dd/mm/yy")
End Sub

And placed this in the userform code
Is that where is belongs?


Yes.

I do not get any change in the textbox apperanace ????

Is there somehting i need to change in the textbox properties also ??

I have it linked to cell E2.


Delete the ControlSource property value and retry the suggested code
..


---
Regards,
Norman


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Date Value in wrong format on userform

That was it.
The E2 that was in the controlsource.
Perfect.
Thanks for the help,

did you notice my other clipboard post problem ?

ctm
"Norman Jones" wrote in message
...
Hi Corey,

Ina ctual fact i am now geting what i originally had.
I read you other post and tried:

Private Sub UserForm_Initialize()
Me.TextBox1.Value = _
Format(Range("E2").Value, "dd/mm/yy")
End Sub

And placed this in the userform code
Is that where is belongs?


Yes.

I do not get any change in the textbox apperanace ????

Is there somehting i need to change in the textbox properties also ??

I have it linked to cell E2.


Delete the ControlSource property value and retry the suggested code
.


---
Regards,
Norman



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Corey,

I now can get 31/10/06 instead of 10/31/06,
But my aim is for "31 October 2006"

I tried changing the .value to .text but no go.
Any idea's


Either:

Me.TextBox1.Value = _
Format(Range("E2").Value, "dd mmmm yyyy")

or

Me.TextBox1.Text = Range("E2").Text

worked for me.

The first stipulates the format of the TextBox, the second returns the text
as seen in the worksheet


---
Regards,
Norman




  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Date Value in wrong format on userform

I seem to still get, in the textbox properties under the text tab
the10/31/2006 even though i did not put it there.

I think this may be causing the absence of 31 October 2006.

I can type that in the text tab but i then get no text displayed on the
userform at all.

tried the
Me.TextBox1.Text = Range("E2").Text

but i still get the same 10/31/2006???


"Norman Jones" wrote in message
...
Hi Corey,

I now can get 31/10/06 instead of 10/31/06,
But my aim is for "31 October 2006"

I tried changing the .value to .text but no go.
Any idea's


Either:

Me.TextBox1.Value = _
Format(Range("E2").Value, "dd mmmm yyyy")

or

Me.TextBox1.Text = Range("E2").Text

worked for me.

The first stipulates the format of the TextBox, the second returns the
text as seen in the worksheet


---
Regards,
Norman



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Corey,

See me preceding response - remove the ControlSource assignment.


---
Regards,
Norman


"Corey" wrote in message
...
I seem to still get, in the textbox properties under the text tab
the10/31/2006 even though i did not put it there.

I think this may be causing the absence of 31 October 2006.

I can type that in the text tab but i then get no text displayed on the
userform at all.

tried the
Me.TextBox1.Text = Range("E2").Text

but i still get the same 10/31/2006???



  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Date Value in wrong format on userform

TextBox1.Text = Format(TextBox1.Text,"d mmmm yyyy")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Corey" wrote in message
...
I have a textbox that displays the value of a cell(E2), but the worksheet
displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October
2006) ?


Corey....


  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Date Value in wrong format on userform



On Nov 7, 10:32 am, "Corey" wrote:
I have a textbox that displays the value of a cell(E2), but the worksheet displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October 2006) ?


If your userform knows the address of the cell, or has a range that
points to it, then the .Text property should display the date as it is
seen in the worksheet...

Mike

  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Mike,

If your userform knows the address of the cell, or has a range that
points to it, then the .Text property should display the date as it is
seen in the worksheet...


I think that you will find that, without an intervening format instruction,
the textbox will speak with VBA's intrinsic American accent!


---
Regards,
Norman



"Mike Woodhouse" wrote in message
oups.com...


On Nov 7, 10:32 am, "Corey" wrote:
I have a textbox that displays the value of a cell(E2), but the worksheet
displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October
2006) ?


If your userform knows the address of the cell, or has a range that
points to it, then the .Text property should display the date as it is
seen in the worksheet...

Mike





  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Value in wrong format on userform

Hi Mike,

I withdraw my comment with apologies!

Me.TextBox1.Text = Range("E2").Text

will display the worksheet's visual representation of the date,



---
Regards,
Norman


  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Date Value in wrong format on userform

Hi,

A word of caution with the .Text property.
If the column is not wide enough to display the date and instead
displayed ####### that is what will be returned in the textbox.

Cheers
Andy

Mike Woodhouse wrote:

On Nov 7, 10:32 am, "Corey" wrote:

I have a textbox that displays the value of a cell(E2), but the worksheet displays:
31 October 2006, yet the userform textbox value shows 10/31/06.
Is there a way i can change this to display as the sheet view (31 October 2006) ?



If your userform knows the address of the cell, or has a range that
points to it, then the .Text property should display the date as it is
seen in the worksheet...

Mike


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
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
from date format convert to text format is wrong nooris Excel Discussion (Misc queries) 2 February 4th 10 03:41 PM
date in wrong format Mike New Users to Excel 3 November 15th 08 08:42 PM
Date in wrong format GKW in GA Excel Discussion (Misc queries) 6 February 19th 08 03:21 PM
Wrong date format in header Curt Charles PDX Excel Discussion (Misc queries) 1 October 25th 06 10:42 PM
Macro gives the wrong date format chin_un_len[_13_] Excel Programming 0 February 25th 06 12:46 AM


All times are GMT +1. The time now is 07:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"