Showing posts with label Color. Show all posts
Showing posts with label Color. Show all posts

HOW TO HIGHLIGHT ROW AND COLUMN OF ACTIVE CELL USING VBA

How To Hightlight Row and Column Active Cell Using VBA In Excel

How to Highlight Row and Column of Active Cell Using VBA? 

If you have a large Data in Spreadsheet and you may want to highlight the select Cell's Row and Column so you can read your data very easily, HERE I can introduce you Interesting VBA Trick to highlight the row and column of the current cell select. when the cell is changed, the row and column highlight Automatically.

How to Highlight Row Using VBA


The Following these step can help you automatically highlight the row of the select cell. Follow the steps

Goto The Developer Tab on the Ribbon and click Visual Studio Button. Shortcut key is (Alt+F11)
Paste The Code In VBA Module 

Row Color Select Cell Using VBA


VBA CODE:

Option Explicit
Private LastAddress As String
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If LastAddress <> "" Then
Range(LastAddress).EntireRow.Interior.ColorIndex = xlNone
End If
ActiveCell.EntireRow.Interior.ColorIndex = 7
LastAddress = Target.Address
End Sub

Change Color Index Number To Change Color on Sheet

How to Highlight Column Using VBA

The Following these step can help you automatically highlight the column of the select cell. Follow the steps

Goto The Developer Tab on the Ribbon and click Visual Studio Button. Shortcut key is (Alt+F11)
Paste The Code In VBA Module 

Column Color Using VBA



VBA CODE:

Option Explicit
Private LastAddress As String
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If LastAddress <> "" Then
Range(LastAddress).EntireColumn.Interior.ColorIndex = xlNone
End If
ActiveCell.EntireColumn.Interior.ColorIndex = 7
LastAddress = Target.Address
End Sub


Change Color Index Number To Change Color on Sheet

How to Highlight Column and Row Using VBA


The Following these step can help you automatically highlight the column and row of the select cell. Follow the steps

Goto The Developer Tab on the Ribbon and click Visual Studio Button. Shortcut key is (Alt+F11)
Paste The Code In VBA Module


Column And Row Color Using VBA In Excel



VBA CODE:

Option Explicit
Private LastAddress As String
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If LastAddress <> "" Then
Range(LastAddress).EntireRow.Interior.ColorIndex = xlNone
Range(LastAddress).EntireColumn.Interior.ColorIndex = xlNone
End If
ActiveCell.EntireRow.Interior.ColorIndex = 7
ActiveCell.EntireColumn.Interior.ColorIndex = 5
LastAddress = Target.Address
End Sub


Watch Video For Easy Learning