Damn Dates

R

robzrob

I've got this code line: || Worksheets("Leave").Range("B6").Value =
UserForm1.TextBox2.Value || to prompt the user for a date which will
be input in UK mode and which I want to appear in B6 in UK mode, ie dd/
mm/yy. It's putting it in B6 ok, but wrongly, eg if I type in
10/08/09 (10 AUG 09), 08/10/09 appears in B6.
 
R

robzrob

Hi,

Try

Range("B6") = CDate(Me.TextBox1.Text)

Wkr,

JP






- Show quoted text -

Sorry, it didn't like that, wouldn't run. I tried it 2 ways:
replacing the whole of
Worksheets("Leave").Range("B6").Value = UserForm1.TextBox2.Value with:

Range("B6") = CDate(Me.TextBox1.Text)

and also replacing part of my current line with yours like this:

Worksheets("Leave").Range("B6") = CDate(Me.TextBox1.Text)
 
R

robzrob

Sorry, it didn't like that, wouldn't run.  I tried it 2 ways:
replacing the whole of
Worksheets("Leave").Range("B6").Value = UserForm1.TextBox2.Value with:

Range("B6") = CDate(Me.TextBox1.Text)

and also replacing part of my current line with yours like this:

Worksheets("Leave").Range("B6") = CDate(Me.TextBox1.Text)- Hide quoted text -

- Show quoted text -

Ah - just seen it - should be TextBox2 - not TextBox1 ! ! ! ! ! Will
re-try.
 
J

JP Ronse

Hi,

You are welcome, keep in mind that VBA knows only American dateformat.

Wkr,

JP

Ah - just seen it - should be TextBox2 - not TextBox1 ! ! ! ! ! Will
re-try.- Hide quoted text -

- Show quoted text -

It's working - thanks.
 
R

robzrob

Hi,

You are welcome, keep in mind that VBA knows only American dateformat.

Wkr,

JP






It's working - thanks.- Hide quoted text -

- Show quoted text -

I think we should scrap both and use yy/mm/dd - that would solve a lot
of problems!
 

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