This macro is stopping with a compile error:
"sub or function not defined"
and Row
is highlighted.
I am using Microsoft Excel for Microsoft 365.
Sub test()
Range(Address(Row(), Column()) & ":" & Address(Row(), Column() 5)).Select
End Sub
CodePudding user response:
ROW Function ... If reference is omitted, it is assumed to be the reference of the cell in which the ROW function appears.Row function
As your sub-routine, test
, isn't in a spreadsheet it wouldn't have the function defined. You might be interested in the Row attribute of Range.
CodePudding user response:
Something like this, maybe.
Sub GetRowNumberFromCellAddress()
Range("A10").Select ' example
Dim col, row
col = Split(Selection.Address, "$")(1)
row = Split(Selection.Address, "$")(2)
MsgBox "Column is : " & col
MsgBox "Row is : " & row
End Sub
Check out the link below, for more info.