• Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us

No products in the cart.

  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us

No products in the cart.

  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us

No products in the cart.

  • Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
  • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips
  • POLICIES
    • PAYMENT GUIDE
    • SHIPPING POLICY
    • REFUND POLICY
    • TERMS & CONDITIONS
    • Contact Us
Excel

Highlighting columns or rows in Excel when selected

0 Comments

Highlighting columns or rows in Excel when selected: To make the contents or important data in an Excel spreadsheet clearer, we have the option to shade alternate rows or cells in Excel, depending on the position where we want to emphasize the content. Then, the alternating colors will display for all the data objects in the table. If you only want to have the highlight when you click directly, you can use VBA code. With this method, the table data will be highlighted by row or column when compared, just by clicking the mouse when needed. Please follow the article below to learn how to use VBA to highlight columns and rows in Excel.

1. Highlighting Excel columns

Step 1: To highlight the row by shading that row when you click any cell, first, press the Alt + F11 shortcut keys to open the Microsoft Visual Basic for Applications window.
Step 2: Now, the VBA window will appear. Double-click on the sheet you want to operate in the sheet list on the left. Then copy the following code segment:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error Resume Next

Cells.Interior.ColorIndex = 0

ActiveCell.EntireColumn.Interior.ColorIndex = 8

Application.CutCopyMode = True

End Sub

Highlighting columns or rows in Excel when selected

Highlighting columns or rows in Excel when selected

Step 3: Then press Alt + Q to close the VBA window. After that, return to the Excel worksheet. Then, just click any cell and the column containing that cell will be highlighted.

Highlighting columns or rows in Excel when selected

Highlighting columns or rows in Excel when selected

2. Highlighting Excel rows

Step 1: To highlight the row by shading that row when you click any cell, first, press the Alt + F11 shortcut keys to open the Microsoft Visual Basic for Applications window.
Step 2: Now, the VBA window will appear. Double-click on the sheet you want to operate in the sheet list on the left. Then copy the following code segment:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error Resume Next

Cells.Interior.ColorIndex = 0

ActiveCell.EntireRow.Interior.ColorIndex = 8

Application.CutCopyMode = True

End Sub

Highlighting columns or rows in Excel when selected

Highlighting columns or rows in Excel when selected

Step 3: Then press Alt + Q to close the VBA window. After that, return to the Excel worksheet. Then, just click any cell and the row containing that cell will be highlighted.

Highlighting columns or rows in Excel when selected

Highlighting columns or rows in Excel when selected

3. Highlighting both Excel columns and rows

Step 1: To highlight both columns and rows by shading that row when you click any cell, first, press the Alt + F11 shortcut keys to open the Microsoft Visual Basic for Applications window.
Step 2: Now, the VBA window will appear. Double-click on the sheet you want to operate in the sheet list on the left. Then copy the following code segment:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error Resume Next

Cells.Interior.ColorIndex = 0

ActiveCell.EntireRow.Interior.ColorIndex = 8

ActiveCell.EntireColumn.Interior.ColorIndex = 8

Application.CutCopyMode = True

End Sub

Highlighting columns or rows in Excel when selected

Highlighting columns or rows in Excel when selected

Step 3: Then press Alt + Q to close the VBA window. After that, return to the Excel worksheet. Then, just click any cell and both the row and column containing that cell will be highlighted.

Highlighting columns or rows in Excel when selected

Highlighting columns or rows in Excel when selected

In conclusion, highlighting columns or rows in Excel can be a helpful way to emphasize important data in a spreadsheet. By following the steps above, you can easily use VBA code to highlight either columns, rows, or both, depending on your needs. This feature can save you time and effort when working with large datasets in Excel, making it easier to identify and analyze important information. So, try it out and see how it can benefit your work with Excel.

 

Rate this post
35
257 Views
How to fix the position and size of images in ExcelPrevHow to fix the position and size of images in ExcelMarch 25, 2023
How to Refresh Data Connections and Pivot Tables using Excel VBAMarch 25, 2023How to Refresh Data Connections and Pivot Tables using Excel VBANext

Leave a Reply Cancel reply

You must be logged in to post a comment.

Buy Windows 11 Professional MS Products CD Key
Buy Office 2021 Professional Plus Key Global For 5 PC
Top rated products
  • Windows Server 2022 Remote Desktop Services User Connections (50) Cal Key Global Windows Server 2022 Remote Desktop Services User Connections (50) Cal Key Global
    Rated 5.00 out of 5
    $22.00
  • AVG Ultimate 2021 with Antivirus + Cleaner, Secure VPN 10 Devices 2 Years AVG Ultimate 2021 with Antivirus + Cleaner, Secure VPN 10 Devices 2 Years
    Rated 5.00 out of 5
    $47.00
  • Avast Premium Security 2021 10 Devices 1 Year Global Avast Premium Security 2021 10 Devices 1 Year Global
    Rated 5.00 out of 5
    $28.00
  • Avast Ultimate Suite 2021 3 Years 10 Devices Global Avast Ultimate Suite 2021 3 Years 10 Devices Global
    Rated 5.00 out of 5
    $90.00
  • Windows Server 2022 Remote Desktop Services Device Connections (50) Cal Key Global Windows Server 2022 Remote Desktop Services Device Connections (50) Cal Key Global
    Rated 5.00 out of 5
    $22.00
Products
  • Windows Server 2025 Standard Windows Server 2025 Standard $30.00
  • Windows 11 Pro Product Activation Key Windows 11 Pro Product Activation Key
    Rated 5.00 out of 5
    $6.00
  • Windows Server 2025 Remote Desktop Services 50 User Connections Windows Server 2025 Remote Desktop Services 50 User Connections $25.00
  • Avast Premium Security 2021 Avast Premium Security 2021 1 Device 1 Year Global
    Rated 5.00 out of 5
    $11.00
  • Buy Windows 11 Professional MS Products CD Key Buy Windows 11 Professional MS Products CD Key
    Rated 5.00 out of 5
    $6.00
  • Avast Ultimate Suite 2021 1 Year 10 Devices Global Avast Ultimate Suite 2021 1 Year 10 Devices Global
    Rated 5.00 out of 5
    $54.00
  • Microsoft SQL Server 2019 Enterprise Microsoft SQL Server 2019 Enterprise $39.00
  • Microsoft Visual Studio 2022 Professional Key Microsoft Visual Studio 2022 Professional Key $19.00
  • Windows 11 Pro Key Global Windows 11 Pro Key Global
    Rated 5.00 out of 5
    $6.00
  • Office 2016 Home and Student for PC Key CD Key Global Office 2016 Home and Student for PC Key CD Key Global
    Rated 4.96 out of 5
    $14.00
Product categories
  • Anti Virus
  • Microsoft Office
  • Microsoft Project
  • Microsoft Visio
  • Microsoft Visual
  • Microsoft Windows
  • Other Software
  • Uncategorized

Buffcom.net always brings the best digital products and services to you. Specializing in Office Software and online marketing services

BIG SALE 50% IN MAY

Microsoft Office
Microsoft Windows
Anti-Virus
Contact Us

Visit Us:

125 Division St, New York, NY 10002, USA

Mail Us:

buffcom.net@gmail.com

TERMS & CONDITIONS | PAYMENT GUIDE  | SHIPPING POLICY  | REFUND POLICY

Copyright © 2019 buffcom.net  All Rights Reserved.