macro to obtain row column like ctrl-end does

I need a basicmacro in Calc that will get the row and column of the last filled cell like ctrl-end does, but without moving the cursor. Any ideas?

Hi

The UsedRange.ods attached contains 3 macros.

  • UsedRange gives the column and line numbers of the used range
  • UsedRangeFrom gives the column and line numbers of the used range, starting with F3
  • UsedRangeFormula gives (and select) the range displaying results in a calculated column

More details on this wiki page (french).

Regards

Hello @PYS

I’ve seen a slightly different answer at
here

Can you teach the other way ?
Thank you

Hi @moshe11

This answer is not different: it also uses a cursor (a way to virtually move in sheet, current selection is not changed). This tool (cursor) expects a boolean.

  • False: after “going to end” you get a cell.
  • True: you get a range of cells.

In 2 cases the returned object has an address. The address is a complex object with properties including the end column / row.

Regards