Enable the Developer tab, record a formatting macro, and clean the generated code in the VBE.
“Recording & Editing Your First VBA Macro” is part of Advanced Excel — Professional Data Analysis. Free preview lessons are open to everyone; the remaining lessons are for enrolled learners.