Highlight a Row Depending on Active Cell Using Button?

K

Karen

Is there a way to highlight a row within a range when a cell is
active? The highlight needs to maintain the shading even though it is
no longer active. I've seen code on this site using Worksheet Change
Event but I was wondering if there was a way you could do this by a
Command Button so the user can highlight particular rows by clicking
on a button. For example, the user is on cell A5, clicks on the button
and it highlights Row A5:AV5.
 
K

kkknie

The code is the same as what you saw in the worksheet_change examples
just that it goes in a normal subroutine. Your example would be:

Sub HiLiteIt()
Range("A" & ActiveCell.Row & ":AV"
ActiveCell.Row).Interior.ColorIndex = 33

End Sub

Change 33 to whatever color you want. Then create a button and assig
the macro to it.
 
Top