Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

How to clear all date fields in one step

I have a tab that when I activate it I want to clear all the date related fields. I also have other triggers that I need to use for this same purpose. Each time I have to use 6-7 separate "Clear Field" triggers to clear all the date fields. Is there a way to do this in a more efficient manner, not having to clear every date field individually? (Note: I can't use the "Clear All Fields" selection because I don't want to clear non-date fields).

3 Replies
JonnyPoole
Employee
Employee

Not unless you only have 1 other non-date field in which case you could use 'clear other fields' but i'm sure that is not the case .

A macro call could do this easily and you can call the code from multiple places including an action/trigger but you would have to gauge... they are generally not considered a best practice.

jagan
Luminary Alumni
Luminary Alumni

Hi,

It is possible with below macro

SUB ClearDateFields

SET Doc = ActiveDocument 

Doc.Fields(DateFieldName1).Clear

Doc.Fields(DateFieldName2).Clear

Doc.Fields(DateFieldName3).Clear

'

'

'

Doc.Fields(DateFieldNameN).Clear

END SUB

Call this macro in Sheet triggers..

Note: As Jonathan said using Macros is not good practice, but in this scenario if you don't want to use "Clear Field" triggers then macro is the option.

Regards,

Jagan.

Not applicable

Just try the keyboard shortcut 'Shift+Ctrl+D'