View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
capt capt is offline
external usenet poster
 
Posts: 67
Default Textbox date formatting

Sorry still no joy.
The textbox value is entered on to a data sheet using the following code
LastRow.Offset(1, 14).Value = TextBox15.Text
When I recall the userform the value in the textbox always revert to the
American format. Checking the data sheet it remains formatted as "dd-mmm-yy".
The code I use to recall the date back to the textbox is:
Me.TextBox15.Value = FoundCell.Offset(0, 14).Value

I hope all this makes sense!!

Oh by the way Happy new year when it comes!!!
--
capt


"Mike H" wrote:

It sounds like you have correctly included
Option Explicit
in your code which means all variables must be declared
Try declaring mydate

dim mydate as date

Mike

"capt" wrote:

Sorry,
Here goes:
Compile error
Variable not Defined

with "mydate" highlighted

--
capt


"Mike H" wrote:

perhaps you could share the error message

"capt" wrote:

Sorry that didnt work. I get an error message.
--
capt


"Mike H" wrote:

Maybe

mydate = Date
TextBox15.Value = Format(mydate, "dd-mmm-yy")

Mike

"capt" wrote:

I have a userform which has a textbox15 which I have formatted to dd-mmm-yy
by using the following code:

Private Sub TextBox15_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
TextBox15.Value = Format(TextBox15.Value, "dd-mmm-yy")
End Sub

But it doesnt work....any ideas?
--
capt