ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Highlighting Rows (https://www.excelbanter.com/excel-discussion-misc-queries/117965-highlighting-rows.html)

Bert

Highlighting Rows
 
I have a time sheet with employees names in column B and there hours in the
rows beside their names for different days. I would like it when I click on
a specific day to enter the hours it highlights the name in that row or the
whole row to make sure I am on the right name.
Thank you


Bob Phillips

Highlighting Rows
 
Option Explicit

'----------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
With .EntireRow
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
.Interior.ColorIndex = 20
End With
End With

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With

End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Bert" wrote in message
...
I have a time sheet with employee's names in column B and there hours in

the
rows beside their names for different days. I would like it when I click

on
a specific day to enter the hours it highlights the name in that row or

the
whole row to make sure I am on the right name.
Thank you





All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com