TextBox Format

  • Thread starter Thread starter grahammal
  • Start date Start date
G

grahammal

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.
 
in the userform initialize event:
Me.Textbox1.text=format(range("A1").Value,"dd-mmm-yyyy")

or

Me.textbox1.text = range("A1").Text
 
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.
 
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
 
Back
Top