ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Date from VBA form comes into worksheet as text (https://www.excelbanter.com/new-users-excel/233979-date-vba-form-comes-into-worksheet-text.html)

ButterflyGirl

Date from VBA form comes into worksheet as text
 
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.
--
Thanks,
Butterfly Girl

Gary''s Student

Date from VBA form comes into worksheet as text
 
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


--
Gary''s Student - gsnu200857


"ButterflyGirl" wrote:

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.
--
Thanks,
Butterfly Girl


Bernie Deitrick

Date from VBA form comes into worksheet as text
 
B-G,

From the form to the worksheet:

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

HTH,
Bernie
MS Excel MVP


"ButterflyGirl" wrote in message
...
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.
--
Thanks,
Butterfly Girl





All times are GMT +1. The time now is 02:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com