There are a few ways to hide macros in Excel. One way is to use the Developer tab. To do this, first open Excel and click on the File tab. Then, click Options. Next, click Customize Ribbon. In the right-hand column, check the box next to Developer. Click OK. The Developer tab should now be visible in the ribbon at the top of the screen.
With the Developer tab open, click on Visual Basic in the Code group. This will open the Visual Basic Editor (VBE). In the VBE, click Insert > Module. A new module will appear in the left-hand pane.
Paste your macro code into the new module. To run a macro from the VBE, press F5 or click Run > Run Sub/UserForm. Your macro will now be hidden from view.
Another way to hide macros is to save your Excel file as a Macro-Enabled Workbook (.xlsm). To do this, go to File > Save As and select Macro-Enabled Workbook from the Save as type drop-down menu. Your macros will be hidden when the file is closed.