I am extremely new to VBA, so I hope that this is easy to do and I am just missing the obvious. I have code that defines a named range as the active row, and another that does the same for the active column. How to I combine the two into one sub so that I can automatically calculate active row and column at the same time? I am using these named ranges in various formulas.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ThisWorkbook.Names("ActiveRow")
.Name = "ActiveRow"
.RefersToR1C1 = "=" & ActiveCell.Row
End With
End Sub
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ThisWorkbook.Names("ActiveColumn")
.Name = "ActiveColumn"
.RefersToR1C1 = "=" & ActiveCell.Column
End With
End Sub