Home » excel » How do I extract the row number from a cell reference in Excel using Applescript?

How do I extract the row number from a cell reference in Excel using Applescript?

Posted by: admin May 14, 2020 Leave a comment

Questions:
tell application "Microsoft Excel"
          set ac to get address of active cell
-- set rw to row of ac
          log ("Active cell: " & ac & return & "Row from Active Cell: " & rw)
end tell

Line 3 will not compile but I need something along those lines.

How to&Answers:

To get at cell and row numbers you can use the first row index and the first column index from Excel’s range class.

I recommend you dig through the Excel Applescript dictionary, lots of clues in there to possible syntax to try.

For your case:

set rw to the first row index of the active cell