Simple date on form

K

kymmy

Hi. I need to show the current date in a text box on a form, allow tha
date to be edited if need be by the user, then when the user clicks th
save button, save the edited (or if not edited, current date) to th
worksheet. I also don't want the date to read mm/dd/yy. I would lik
it to read dd/mm/yy.

I'm pretty sure I know how to save to the worksheet, but I thought
had better mention it, as there may be some little trick to it!.

Can anyone help me please
 
P

Paul B

Do you need it to be on a form? using an input box would be easier,
something like this

Sub Insert_Date()
MyValue = InputBox("Enter the date you want", "Pick a date", Format(Date,
"mm/dd/yy"))
If MyValue = "" Then
Exit Sub
End If
Range("A1").Value = MyValue
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 
K

kymmy

Thanks for that idea Paul, but I do have to have it on a form. It i
only a small part of a payroll input form.

I need it to show the current date, but be able to be edited if nee
be
 
K

kymmy

Sorry - wrong word used! I meant to say a payroll form, where the use
enters information.

It is not an input form. (I thought I better clarify that incase
confuse you with what I am doing)
 
P

Paul B

Kymmy, asuming that your userform is userform1 and the textbox is textbox1

UserForm1.TextBox1.Value = Date 'will put the date in the textbox

then put this in the Command Button Click event for the save
ActiveSheet.[A1].Value = UserForm1.TextBox1.Value 'will put whats in the
textbox in A1 on the active sheet
TextBox1.Value = "" 'resets the text box

I maybe mistaken but if you are set to US date system, you MUST enter dates
as mm/dd/yy. You can change the format in the cell after the date is put in

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 
K

kymmy

Thank you very much Paul - that is perfect!

I don't want American time, as I'm Australian, and the American time o
mm/dd/yy always confuses me! (I do have my regional settings on m
computer set to dd/mm/yy).

Thanks again!!:
 
P

Paul B

Your Welcome

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 

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