# MOVECELLS

#### Syntax <a href="#syntax" id="syntax"></a>

**MOVECELLS**(*range*; *direction*; *option*)

* *range* - the range in which cells should be moved - ***Value type**: range*
* *direction* - the direction in which the non-empty cells should be moved - ***Value type**: constant*

  Possible values are

  * *leftward* - move non-empty cells to the left
  * *rightward* - move non-empty cells to the right
  * *upward* - move non-empty cells up
  * *downward* - move non-empty cells down
* *option* - specifies if empty cells between non-empty cells should be removed - ***Value type**: constant (optional, default: outside)*

  Possible values are

  * *outside* - only the first or last empty cells are removed
  * *inside* - only empty cells between non-empty cells are removed
  * *both* - all empty cells outside and inside are removed

#### Remarks <a href="#remarks" id="remarks"></a>

* The size of the range is preserved, even if the last or first columns or rows contain only empty cells after the operation.
* Common use cases include retrieving leaf elements of a column-based hierarchy or converting a hierarchy to a single column.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nedyx.com/nedyx/clearlines-functions/range-functions/movecells.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
