Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

Highlight Active Cell

 

Highlight Active Cell

Below we will look at a program in Excel VBA that highlights the row and column of the Active Cell (selected cell). This program will amaze and impress your boss.

Situation:

Highlight Active Cell in Excel VBA


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit 

SubApplication.ScreenUpdating = False

'Clear the color of all 

cellsCells.Interior.ColorIndex = 0

Cells.Font.ColorIndex = 0

Cells.Font.FontStyle = "Normal"

'With Target'Highlight row and column of the selected 

cell.EntireRow.Interior.ColorIndex = 6

EntireRow.Font.ColorIndex = 7

EntireRow.Font.FontStyle = "Bold"

EntireColumn.Interior.ColorIndex = 6

EntireColumn.Font.ColorIndex = 7

EntireColumn.Font.FontStyle = "Bold"

End With

Application.ScreenUpdating = True

End Sub

Post a Comment

0 Comments