Auto Row Highlighting Works on Only One Sheet

Snake Eyes

Board Regular
Joined
Dec 14, 2010
Messages
103
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Greetings,
I've applied the code below to two (2) sheets in the same workbook. These two worksheets are identically configured when it comes to columns, formatting and macros. The only difference is the data/values in the rows/cells.

The code highlights a row by bolding and underlining text when the row is selected. The code works in Sheet1 but not in Sheet2.
Can someone help me understand why this is?

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' Sets the selected row text to bold and underline
    With ThisWorkbook.Names("HighlightRow")
.Name = "HighlightRow"
.RefersToR1C1 = "=" & ActiveCell.Row
End With
End Sub

Here is the formatting for the first sheet that works...
Formatting 1st Sheet.JPG


Here it is for the 2nd sheet that does not work...
Formatting 2nd Sheet.JPG
 

Attachments

  • Formatting.JPG
    Formatting.JPG
    24.9 KB · Views: 7
  • Formatting 2nd Sheet.JPG
    Formatting 2nd Sheet.JPG
    47 KB · Views: 4
Last edited:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I should clarify that my first worksheet (where the formatting works) is Excels "Sheet 3" and my 2nd worksheet (where is does not work) is Excels "Sheet 8".
 
Upvote 0
I've discovered that when these two sheets are in the same workbook, the auto formatting will only work on one of the worksheets. It will only work on both sheets when they are separated into two different workbooks.
Any assistance in identifying the reason for this would be greatly appreciated.
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top