TextBox Format

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.
 
G

Guest

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

or

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

grahammal

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.
 
J

Jim May

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top