Date from VBA form comes into worksheet as text

B

ButterflyGirl

In a form I input a date & when it comes across to the excel worksheet it
recognises it as text rather than a date (even though it looks like a date eg
in worksheet date looks like 16/06/09.
Look forward to your answer.
 
G

Gary''s Student

Make sure its Dim'ed correctly:

Sub OnlyaMoth()
Dim d As Date
d = Application.InputBox(prompt:="Give me a date", Type:=1)
Range("A1").Value = d
End Sub
 
B

Bernie Deitrick

B-G,

From the form to the worksheet:

Worksheets("Sheet Name").Range("A1").Value = DateValue(me.Textbox1.Text)

HTH,
Bernie
MS Excel MVP
 

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