Moving cells, entire rows or entire columns via drag and drop

I know it’s a dumb question, but I can’t find the answer in the help facility:

How do you move a row (or rows) up or down a spreadsheet? Or move columns across?

Thanks in advance,
Oliver

See an example in this question, How to drag an existing cell, or cells, to new location in Calc - #2 by EarnestAl

You answered the wrong question. I want to move ROWS (or COLUMNS) not individual cells.

99457 – Ability to move rows, columns using one hand and preserving all existing content

for Columns:

insert_move_remove_columns(*_):
    """
    1. insert Column[s] at target position
    2. **move** source to target position
    3. **removes empty Columns at source-range

    select source-Column[s] and
    meanwhile holding ctrl-key select cell where to move
    **run me**
    """
    doc = XSCRIPTCONTEXT.getDocument()
    source, target = doc.CurrentSelection
    offset = 0
    if not hasattr(target, "CellAddress"):
        source, target = target, source
        offset = source.Columns.Count
    sheet = source.Spreadsheet
    address = target.CellAddress
    rc = source.RangeAddress.StartColumn + offset
    sheet.Columns.insertByIndex(address.Column, (c:=source.Columns.Count))
    sheet.moveRange(address, source.RangeAddress)
    sheet.Columns.removeByIndex(rc, c )

Select
Moving Cells by Drag-and-Drop

Hello,

Thanks for this. I only noticed it today because it went to spam (now fixed). And I apologise for my rather terse follow-up because I thought it was an AI bot giving an answer to a question I hadn’t asked!

It would be helpful if the help item were to be renamed from “Moving cells by drag and drop” to “Moving cells, entire rows or entire columns via drag and drop” or similar. I couldn’t find it when searching the help menu!

Thanks again,
Oliver

1 Like

It is AL not ai.

Done. See the pencil near the question title.