ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   TextBox Format (https://www.excelbanter.com/excel-discussion-misc-queries/80013-textbox-format.html)

grahammal

TextBox Format
 

I have a TextBox on a UserForm that shows what is in cell "A1" on my
spreadsheet.
The contents of "A1" is always a date and is formatted to show the date
as dd-mmm-yyyy.
Assuming the date in cell "A1" is 28-Mar-2006, and by highlighting the
cell it also shows the same format at the top of the spreadsheet, why
does the TextBox show the date as 3/28/2006??
I want it to look like "A1" or at the very least 28/3/2006.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=527111


Bob Umlas, Excel MVP

TextBox Format
 
in the userform initialize event:
Me.Textbox1.text=format(range("A1").Value,"dd-mmm-yyyy")

or

Me.textbox1.text = range("A1").Text

"grahammal" wrote:


I have a TextBox on a UserForm that shows what is in cell "A1" on my
spreadsheet.
The contents of "A1" is always a date and is formatted to show the date
as dd-mmm-yyyy.
Assuming the date in cell "A1" is 28-Mar-2006, and by highlighting the
cell it also shows the same format at the top of the spreadsheet, why
does the TextBox show the date as 3/28/2006??
I want it to look like "A1" or at the very least 28/3/2006.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=527111



grahammal

TextBox Format
 

Where exactly do I enter what you have suggested. Am using Excel97

By the way, What does Me.xxxxxxx actually mean as I have tried to enter
suggested commands before and it always errors because of the 'Me' part
of the
program.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=527111


Jim May

TextBox Format
 
In the VBE environment "select" your Userform in the Project Explorer
window, then at the menu click on View, then Code..
In code window that comes up (Userform should appear in the Left top
dropdown Object box)

Type out in the code window:

Private Sub UserForm_Initialize()

Me.Textbox1.text=format(range("A1").Value,"dd-mmm-yyyy")
End Sub

The Keyword "Me" means (a substitute for) "the objectname that this code
resides in"
HTH,
Jim May


"grahammal" wrote
in message ...

Where exactly do I enter what you have suggested. Am using Excel97

By the way, What does Me.xxxxxxx actually mean as I have tried to enter
suggested commands before and it always errors because of the 'Me' part
of the
program.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile:
http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=527111





All times are GMT +1. The time now is 04:42 AM.

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