• Microsoft Office
  • Microsoft Windows
  • Other Software
    • Microsoft Visual
    • Microsoft Project
    • Microsoft Visio
    • Anti Virus
  • Blog
    • Word
    • Excel
    • Powerpoint
    • Software tricks/tips

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

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

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
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
48
300 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
  • Kaspersky Small Office Security 15 PCs + 15 Mobiles + 2 Servers 1 Year Kaspersky Small Office Security 15 PCs + 15 Mobiles + 2 Servers 1 Year
    Rated 5.00 out of 5
    $201.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
  • 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
  • Buy Office 2021 Professional Plus Key Global For 5 PC Buy Office 2021 Professional Plus Key Global For 5 PC
    Rated 5.00 out of 5
    $68.00
  • Avast SecureLine VPN 2021 2 Years 5 Devices Global Avast SecureLine VPN 2021 2 Years 5 Devices Global
    Rated 5.00 out of 5
    $47.00
Products
  • Trend Micro Internet Security 3 Devices 1 Year Key GLOBAL Trend Micro Internet Security 3 Devices 1 Year Key GLOBAL
    Rated 5.00 out of 5
    $17.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
  • Kaspersky Small Office Security 10 PCs + 10 Mobiles + 1 Server 1 Year Kaspersky Small Office Security 10 PCs + 10 Mobiles + 1 Server 1 Year
    Rated 5.00 out of 5
    $164.50
  • Buy Microsoft Office Professional Plus 2019 CD Key Global - 5 PC Buy Microsoft Office Professional Plus 2019 CD Key Global - 5 PC
    Rated 4.95 out of 5
    $32.00
  • Microsoft Visio Professional 2021 Key 1PC Microsoft Visio Professional 2021 Key 1PC $13.00
  • Windows Server 2012 R2 Datacenter Key Global Windows Server 2012 R2 Datacenter Key Global
    Rated 4.71 out of 5
    $15.00
  • Microsoft Visio Standard 2016 Key 1PC Microsoft Visio Standard 2016 Key 1PC $9.00
  • AVG Internet Security 2021 10 Devices 1 Year Global AVG Internet Security 2021 10 Devices 1 Year Global
    Rated 5.00 out of 5
    $30.00
  • Project Professional 2013 Microsoft Project Professional 2013 - 1 PC $9.00
  • Visio Professional 2024 Visio Professional 2024 $43.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.