logo
search
VBA & Macro Problems

How to Highlight the Active Cell in Shared Excel Workbooks

Maira MehtabMaira Mehtab Sep 21, 2026 868 views

Question details

The user needs a way to visually highlight the currently selected cell in a shared workbook to make it easier to identify while collaborating.

Product
Microsoft Excel
Device & OS
not provided
Scenario
Working collaboratively in a shared Excel workbook via Microsoft Teams, where identifying the currently active cell is difficult.
Observed behavior
The default active cell indicator is too subtle and hard to spot in a shared environment, causing navigation and editing inefficiencies.
Before you start

Ensure you are using the desktop version of Excel, as VBA macros are not supported in Excel for the Web (the default viewing mode in Microsoft Teams).

Solution 1Recommended

Highlight the Active Cell Using a VBA Macro

Apply a VBA macro to the worksheet's SelectionChange event to automatically update the background color of whichever cell you select.

This method uses a macro to clear any previous fill colors on the sheet and instantly apply a new highlight to your active cell. Because it relies on VBA, all team members must open the shared file in the Excel desktop application rather than the web viewer.

1
Open the VBA Editor

While in the Excel desktop app, press 'Alt + F11' on your keyboard to launch the Visual Basic for Applications (VBA) editor.

2
Select the Target Worksheet

In the Project Explorer pane on the left, double-click the specific worksheet (e.g., 'Sheet1') where you want the active cell to be highlighted.

3
Add the SelectionChange Code

Select 'Worksheet' from the left dropdown menu and 'SelectionChange' from the right. Add a script to clear the background (e.g., Cells.Interior.ColorIndex = 0) and color the active cell (e.g., Target.Interior.ColorIndex = 6 for yellow).

4
Save as a Macro-Enabled Workbook

Close the VBA editor. Go to File > Save As, and change the file format to Excel Macro-Enabled Workbook (*.xlsm) so the code runs during your next session.

Web App Limitation: Macros do not run in Excel for the Web. You and your team members must select 'Open in Desktop App' from Teams for the highlight macro to function.
Easier Highlight Alternative

Highlight Cells Instantly with WPS Spreadsheet

WPS Office offers a built-in 'Reading Layout' feature that automatically highlights the active cell's entire row and column without writing any VBA code. It is fully compatible with Microsoft Excel files.

  1. 1. Open Your Shared File: Launch WPS Spreadsheet and open your collaborative workbook.
  2. 2. Navigate to the View Tab: Click on the 'View' tab located in the top ribbon menu.
  3. 3. Activate Reading Layout: Click the 'Reading Layout' button. Selecting any cell will now instantly highlight its entire row and column, making it incredibly easy to track.
  4. 4. Customize the Highlight Color: Click the small dropdown arrow next to the Reading Layout button to pick a custom highlight color that suits your preference.
Built-in Reading Layout highlights active cells instantly without VBAFully compatible with Microsoft Excel formats (.xlsx, .xlsm)Supports advanced VBA macros for complex automationLightweight, free to download, and easy to use
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my VBA macro working in Microsoft Teams?

Microsoft Teams defaults to opening files in Excel for the Web, which does not support VBA macros. To run macros, you must click the 'Open in Desktop App' button within Teams.

Will the VBA highlight macro remove my existing cell colors?

Yes, if your macro uses a command like 'Cells.Interior.ColorIndex = 0' to clear the previous active cell's highlight, it will also remove all other background colors on that worksheet. If you rely heavily on color coding, consider alternative methods.

How do I change the highlight color in the VBA macro?

You can change the color by modifying the ColorIndex value in your VBA code. For example, setting 'Target.Interior.ColorIndex = 6' makes the active cell yellow, while a value of '4' turns it green.

Can I use Conditional Formatting instead of VBA to highlight the active cell?

Yes, you can use Conditional Formatting combined with the CELL('row') and CELL('col') functions. However, this method still requires a very basic VBA macro (Worksheet.Calculate) or manually pressing F9 to force the sheet to refresh every time you click a new cell.