1. Knowing the function you want to realize, you can record macros. Open the view menu and find the macro button under the view menu.
2. Click the macro button shown in the figure below to open the drop-down menu.
3. Click the "Record Macro" button as shown in the figure below in the drop-down menu.
4. You can set an easy-to-remember name for the macro, as shown in the figure below, assuming it is named "Test".
5. Next, you can continue with the steps you want to record as a macro. When all the steps are completed, click Finish Recording from the menu where you just clicked the macro.
6. Next, you can press and hold "Alt+F8" and the following window will pop up. After clicking Execute, Excel will stop and repeat the previous steps, thus realizing the function of recording macros.