The following vba code works very well on my first worksheet, but does not work on any other worksheet.
My names are defined with 'Workbook' scope.
I took the vba code assigned to the first worksheet and copied it to the second worksheet, 'Within the VBA Editor', but somehow, it does not work.
Do I need to tweak something?
------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ThisWorkbook.Names("CurrentRow")
.Name = "CurrentRow"
.RefersToR1C1 = "=" & ActiveCell.Row
End With
With ThisWorkbook.Names("CurrentColumn")
.Name = "CurrentColumn"
.RefersToR1C1 = "=" & ActiveCell.Column
End With
End Sub
--------------------------------------------------------------
My names are defined with 'Workbook' scope.
I took the vba code assigned to the first worksheet and copied it to the second worksheet, 'Within the VBA Editor', but somehow, it does not work.
Do I need to tweak something?
------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ThisWorkbook.Names("CurrentRow")
.Name = "CurrentRow"
.RefersToR1C1 = "=" & ActiveCell.Row
End With
With ThisWorkbook.Names("CurrentColumn")
.Name = "CurrentColumn"
.RefersToR1C1 = "=" & ActiveCell.Column
End With
End Sub
--------------------------------------------------------------