Thread
:
How to change entire row colour when row is selected?
View Single Post
#
2
Posted to microsoft.public.excel.programming
Zone
external usenet poster
Posts: 269
How to change entire row colour when row is selected?
How about this:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Row = 4 Then
Rows(5).EntireRow.Font.ColorIndex = xlAutomatic
Rows(5).EntireRow.Font.Bold = False
ActiveCell.EntireRow.Font.ColorIndex = 3
ActiveCell.EntireRow.Font.Bold = True
End If
If ActiveCell.Row = 5 Then
Rows(4).EntireRow.Font.ColorIndex = xlAutomatic
Rows(4).EntireRow.Font.Bold = False
ActiveCell.EntireRow.Font.ColorIndex = 3
ActiveCell.EntireRow.Font.Bold = True
End If
End Sub
James
wrote:
To anyone who can help,
I am trying to change all the text of a row to red and bold when that
row is selected and then change it back to black and unbold when it is
deselected.
I have achieved the first part of my task with the following code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Row = 4 Then
ActiveCell.EntireRow.Font.ColorIndex = 3
ActiveCell.EntireRow.Font.Bold = True
End If
If ActiveCell.Row = 5 Then
ActiveCell.EntireRow.Font.ColorIndex = 3
ActiveCell.EntireRow.Font.Bold = True
End If
End Sub
Can someone please help with the else statement that I would need to
add so that when I change from say, row 4 to 5, the text in row 4 is
returned to black and unbold while the text in row 5 is changed to red
and bold?
Any help will be much appreciated
Reply With Quote
Zone
View Public Profile
Find all posts by Zone