ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I create list validation from code without the text being converted into date format? (https://www.excelbanter.com/excel-programming/346497-how-do-i-create-list-validation-code-without-text-being-converted-into-date-format.html)

EG[_3_]

How do I create list validation from code without the text being converted into date format?
 
I have a cell whose validation is dynamically changed. I delete and
create it from code. Some of the text that could be used is in the
format of x-y (e.g. 5-7), which sometime is converted into a date (e.g.
7-May). This happens in the Validation.Add function, which means I
can't solve it by just formatting the cell to contain Text.


BrianB

How do I create list validation from code without the text being converted into date format?
 

Don't know if this will be what you want, but we can force a cell to
become text by putting an apostrophe in front. This becomes invisible
in the cell.
eg.
'- put an apostrophe to force cell to text
Range("A1").Value = "'" & "5-7"


--
BrianB


------------------------------------------------------------------------
BrianB's Profile: http://www.excelforum.com/member.php...info&userid=55
View this thread: http://www.excelforum.com/showthread...hreadid=487878


EG[_3_]

How do I create list validation from code without the text being converted into date format?
 

Thanks, Brian, it is a progress. The problem is that I see the
apostrophe in the dropdown, before the value...



All times are GMT +1. The time now is 01:47 PM.

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