Skip to main content
dublove
Legend
Aug 9, 2026 4:56 PM UTC
Answered

How to determine whether the selected cell is one row or multiple rows?

I need to distinguish between the following two situations.
The essence is to distinguish whether it is a single line or multiple lines.

The first option: select 1row (one or more columns).
Second option: Select 2 rows (1 or more columns).

 

    Manan JoshiCorrect answer
    Community Expert
    Aug 10, 2026 2:29 AM UTC

    Use the following code

    app.selection[0].columnSpan

    It will output 1 for your 1st example and 2 for the 2nd one

    -Manan

    2 replies

    Manan JoshiCommunity ExpertCorrect answer
    Community Expert
    Aug 10, 2026 2:29 AM UTC

    Use the following code

    app.selection[0].columnSpan

    It will output 1 for your 1st example and 2 for the 2nd one

    Translate
    -Manan
    dublove
    dubloveAuthor
    Legend
    Aug 10, 2026 3:45 AM UTC

    Hi Manan Joshi.

    Thank you very much.

    app.selection[0].columnSpan
    app.selection[0].rowSpan

    Can be perfectly solved

    Translate