Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlight rows
I would like to make the entire row background color yellow when checked. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .Font.Name = "Marlett" &! nbsp; End If End With End If sub_exit: Application.EnableEvents = True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlight rows
Hi Randy
try Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .entirerow.interior.colorindex= 6 .Font.Name = "Marlett" &! nbsp; End If End With End If sub_exit: Application.EnableEvents = True End Sub -- Regards Frank Kabel Frankfurt, Germany "Randy Reese" schrieb im Newsbeitrag ink.net... I would like to make the entire row background color yellow when checked. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .Font.Name = "Marlett" &! nbsp; End If End With End If sub_exit: Application.EnableEvents = True End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlight rows
-----Original Message----- I would like to make the entire row background color yellow when checked. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .Font.Name = "Marlett" &! nbsp; End If End With End If sub_exit: Application.EnableEvents = True End Sub . By setting EnableEvents to false at the beggining of your procedure you have disabled your code since you are using the SelectionChange event of the worksheet. SelectionChange is of course an event by definition and you have turned it off by setting EnableEvents to false. Don't set EnableEvents to false and that should fix your problem.. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlight rows
Hi
I don't see a problem as the events are enabled again at the end of this code (also in case of an error) -- Regards Frank Kabel Frankfurt, Germany "B.Dryden" schrieb im Newsbeitrag ... -----Original Message----- I would like to make the entire row background color yellow when checked. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .Font.Name = "Marlett" &! nbsp; End If End With End If sub_exit: Application.EnableEvents = True End Sub . By setting EnableEvents to false at the beggining of your procedure you have disabled your code since you are using the SelectionChange event of the worksheet. SelectionChange is of course an event by definition and you have turned it off by setting EnableEvents to false. Don't set EnableEvents to false and that should fix your problem.. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlight rows
Thanks Frank, works good.
Is there a way to keep my grid or redraw after highlight?? "Frank Kabel" wrote in message ... Hi I don't see a problem as the events are enabled again at the end of this code (also in case of an error) -- Regards Frank Kabel Frankfurt, Germany "B.Dryden" schrieb im Newsbeitrag ... -----Original Message----- I would like to make the entire row background color yellow when checked. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .Font.Name = "Marlett" &! nbsp; End If End With End If sub_exit: Application.EnableEvents = True End Sub . By setting EnableEvents to false at the beggining of your procedure you have disabled your code since you are using the SelectionChange event of the worksheet. SelectionChange is of course an event by definition and you have turned it off by setting EnableEvents to false. Don't set EnableEvents to false and that should fix your problem.. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
more rows highlight than I want | Excel Discussion (Misc queries) | |||
highlight duplicate rows | Excel Discussion (Misc queries) | |||
Highlight rows | Excel Worksheet Functions | |||
Can I highlight all the odd rows in Excel? | Excel Discussion (Misc queries) | |||
Any way to highlight rows without using macros? | Excel Discussion (Misc queries) |