• Microsoft Office
  • Microsoft Windows
  • Other Software
  • 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
  • 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
  • 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
  • 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.

 

8
61 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

Your email address will not be published. Required fields are marked *

Recent Posts
  • Retrieve Data Based on Data Validation
    September 7, 2023
    Excel
  • How to Convert Multiple Rows to Columns and Rows in Excel?
    September 6, 2023
    Excel
  • VLOOKUP for Automatic Discount in Data Validation
    September 6, 2023
    Excel
  • How to Convert Text Dates to Dates in Excel?
    September 5, 2023
    Excel
Categories
  • Blog 80
  • Excel 754
  • Powerpoint 36
  • Software tricks/tips 128
  • Uncategorized 8
  • Word 109
Tags
the ISERROR
Top rated products
  • Windows 11 Home Key Global 2021
    Rated 5.00 out of 5
    $15.00
  • Windows Server 2022 Remote Desktop Services User Connections (50) Cal Key Global
    Rated 5.00 out of 5
    $45.00
  • 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
Products
  • Buy Office 2021 Professional Plus Key Global For 5 PC
    Rated 5.00 out of 5
    $45.00
  • Buy Office 2021 Professional Plus Key Global Bind To Your Microsoft Account
    Rated 4.83 out of 5
    $49.00
  • Windows Server 2022 Datacenter Key Global
    Rated 5.00 out of 5
    $15.00
  • Windows Server 2022 Standard Key Global
    Rated 4.47 out of 5
    $15.00
  • Windows Server 2022 Remote Desktop Services Device Connections (50) Cal Key Global
    Rated 5.00 out of 5
    $45.00

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.