Auto Row Highlighting Works on Only One Sheet

Snake Eyes

Board Regular
Joined
Dec 14, 2010
Messages
105
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: 14
  • Formatting 2nd Sheet.JPG
    Formatting 2nd Sheet.JPG
    47 KB · Views: 20
Last edited:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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,224,931
Messages
6,181,838
Members
453,067
Latest member
mdiz777

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