Updating cell value using VBA resets cell formatting

Updating cell value using VBA resets cell formatting

There are cells in my sheet that contain dates, which I have formatted using custom formatting to adjust their appearance.

I also have a macro that updates the value of the cells with an adjusted date.

When the macro is run and the date changes, the custom formatting is removed.

How can I stop this from happening (so that the custom formatting is retained even when the cell value - the date - changes)?