• 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
254 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
  • 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
  • Kaspersky Internet Security 2021 1 year 1 device key Global Kaspersky Internet Security 2021 1 year 1 device key Global
    Rated 5.00 out of 5
    $24.00
Products
  • Buy Windows Server 2016 Essentials Key Global Buy Windows Server 2016 Essentials Key Global
    Rated 4.75 out of 5
    $10.00
  • Windows Server 2019 Datacenter Key Global Windows Server 2019 Datacenter Key Global
    Rated 4.75 out of 5
    $7.00
  • Office 2019 Professional Plus Key Global Bind to your Microsoft Account Office 2019 Professional Plus Key Global Bind to your Microsoft Account
    Rated 4.97 out of 5
    $49.00
  • Project Professional 2024 Project Professional 2024 $33.00
  • Project Standard 2021 Microsoft Project Standard 2021 - 1 PC $13.00
  • Microsoft Visual Studio 2019 Professional Key Microsoft Visual Studio 2019 Professional Key
    Rated 4.84 out of 5
    $15.00
  • Microsoft Project 2019 Professional Key Global Microsoft Project 2019 Professional - 5 PC
    Rated 4.97 out of 5
    $12.00
  • Project Professional 2013 Microsoft Project Professional 2013 - 1 PC $9.00
  • AVG Internet Security 2021 1 Device 1 Year Global AVG Internet Security 2021 1 Device 1 Year Global
    Rated 5.00 out of 5
    $11.00
  • Windows 10 Pro OEM Key Global - Reinstalling win is still active Windows 10 Pro OEM Key Global - Reinstalling win is still active
    Rated 4.88 out of 5
    $6.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.