DATE Format In Macro

i need to write macro to find rows with dates and change their date format to DD/MM/YYYY

thanks in advance

A solution without macro (not perfect but quick and easy to understand!):

  1. Press Ctrl-h to bring up the Find and Replace pop-up window.
  2. Type 2024 in the first field and 2024 in the replace field (yes, the same value!)
  3. Click on Replace All button.
  4. You now have all the cells that contain 2024. You can apply the cell formatting.

Repeat these steps for other years.

The question sounded more like they wanted to change a fixed date display format, replacing cell content with itself wouldn’t do anything there. Unless it’s just date text strings instead of numeric dates, then it would be a case of this FAQ.

By replacing the year by itself, Calc selects all the cells containing 2024. This is the only purpose of the replace that doesn’t change anything. Then you can change the format of all these selected cells.

might be a long story! worth learning regex :wink:

1 Like

What else is in that column? Text? Just format the entire column as dates. Number formats don’t do anything to text.

For that the replacement isn’t needed, just find 2024 and hit Find All, which equally selects matching cells and after closing the dialogs a new number format can be applied to the still selected cells.

1 Like