Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have tried formatting the input fields as text but to no avail. When I step through it in the debugger it shows a double number which I presume is date conversion. I just want it to treat it as text and not convert it to a time/date.

Can somebody tell me how to prevent the conversion?

The text field has YY.MM.DD hh:mm:ss in text. I want to remove the seconds so I use:


This does not work. I have put text in the field and it does truncate the last 3 positions.

share|improve this question
Please check the cell formatting to ensure that it is either "General" or "Formula" and not "Text" on your ref cell. – skub Mar 25 '11 at 3:08
I think this is more of a question for (programming related). – Ben Mar 25 '11 at 4:46

If you're using VBA, try using Format:

Select.Value=FORMAT(Select.Value,"YY.MM.DD hh:mm")
share|improve this answer

Try putting a single quote before the text field to force it to be considered as text.

share|improve this answer

It's not clear what you're trying to achieve with the time value, which affects the solutions proposed. However:

If you specifically want to do it through VBA, you can define a string variable and then pass it the time value:

strTextValue = cstr(format(selection.value,"YY.MM.DD HH:MM"))

You could also do this in the worksheet directly, for example:

=TEXT(range("A1"),"YY.MM.DD HH.MM"))
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .