A macro in Excel is a recorded series of actions, such as formatting a report or cleaning imported data, that Excel saves as VBA code and can replay whenever you need it. To create one, go to View > Macros > Record Macro, give it a name, carry out the steps once, then click Stop Recording. Run it again with Alt + F8, a keyboard shortcut or a button, and save the file as an Excel Macro-Enabled Workbook (.xlsm) so the macro is kept.
Category: Microsoft Excel
To remove duplicates in Excel, click anywhere in your data, go to the Data tab and click Remove Duplicates in the Data Tools group. Tick the columns Excel should compare (all columns removes only identical rows; one column removes repeats of that value), make sure My data has headers is ticked, and click OK. Excel deletes the duplicate rows, keeps the first occurrence of each, and tells you how many were removed.
To lock cells in Excel, select the whole sheet, press Ctrl + 1, and on the Protection tab untick Locked. Then select only the cells you want to lock, press Ctrl + 1 again and tick Locked. Finally, go to Review > Protect Sheet, choose what users can still do, add a password if you want one, and click OK. Locked cells can no longer be edited until you go to Review > Unprotect Sheet.
To freeze panes in Excel, go to the View tab and click Freeze Panes in the Window group. Choose Freeze Top Row to keep your headings visible, or Freeze First Column to keep the left column visible. To freeze several rows and columns at once, select the cell immediately below and to the right of the rows and columns you want to lock (for example C3 to lock rows 1 to 2 and columns A to B), then choose Freeze Panes. To undo it, click Freeze Panes > Unfreeze Panes.
To merge cells in Excel, select the cells you want to combine, go to the Home tab, and click Merge & Center in the Alignment group. Use the dropdown arrow for other options: Merge Across (merges each row separately), Merge Cells (merges without centring) and Unmerge Cells. Merging keeps only the value in the top-left cell and discards the rest, so it is best used for titles and labels, not for data you will sort, filter or analyse.