Access the VBA editor 1. Access the VBA editor Open your Excel file, then press Alt + F11 to open the VBA editor. In the window that opens, you will see a list of your Excel sheets on the left. Double-click on the sheet where you want the highlighting to work (for example, "Sheet1"). 2. Paste the code into the sheet Once the sheet is open in the editor, copy and paste this code into the white area on the right: vba Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone Rows(Target.Row).Interior.Color = RGB(220, 230, 241) End Sub This code will run automatically each time you select a cell in this sheet, highlighting the entire row. 3. Save and test Close the VBA editor by clicking the X or pressing Alt + Q. Back in Excel, click on different cells: you should see the entire row automatically color. If this doesn't work, make sure macros are enabled in your file (File > Options > Trust Center > Macro Settings).
No comments yet