Forum Discussion
How to limit user to enter correct date format values
- Aug 07, 2023
For VBA you need macro-enabled workbook which usually a headache in corporate environment. Office Script actually gives nothing, it doesn't work by event. With it you may only check (pressing the button or like) if dates were entered correctly, but in your case that's actually the same as conditional formatting but more complex.
In general yes, you may work online with macro-enabled workbook, the only macros won't work.
Yes, Excel allows to paste the value on the cell ignoring data validation. Moreover, it will be removed if you paste the cell without data validation.
Workaround with VBA doesn't work in your case since doesn't work on Excel for web.
Another workaround is to use conditional formatting. If the date is entered in wrong format the value is text, not date. Dates in Excel are actually numbers. You may highlight in red texts entered instead of dates checking type of the value in the cell(s).
- Negi1984Aug 07, 2023Copper Contributor
SergeiBaklan, thanks a lot for the idea. I will try to apply the same logic. Also just want to reconfirm ,
if we can use VBA and office script together which work on both cases if user working in Excel app than VBA will work and in case any user working in Excel online version than office script ?
any guidance if you can provide here as well.
- SergeiBaklanAug 07, 2023Diamond Contributor
For VBA you need macro-enabled workbook which usually a headache in corporate environment. Office Script actually gives nothing, it doesn't work by event. With it you may only check (pressing the button or like) if dates were entered correctly, but in your case that's actually the same as conditional formatting but more complex.
In general yes, you may work online with macro-enabled workbook, the only macros won't work.