# Moving Rows or Columns

Learn how to enable user-driven row and column movement in your application using Spread.NET with this comprehensive guide.

## Content

You can allow the user to drag and move rows or columns. Set the [AllowRowMove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowRowMove.html) property to allow the user to move rows and the [AllowColumnMove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowColumnMove.html) property to allow the user to move columns. If you wish to allow the user to move multiple rows or columns, also set the [AllowRowMoveMultiple](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowRowMoveMultiple.html) or [AllowColumnMoveMultiple](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowColumnMoveMultiple.html) property.
You can hide the drag band while moving the row or column with the [ShowDragBandOnMoving](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.ShowDragBandOnMoving.html) property.
For the user to move rows or columns, they left click on the header of the row or column to move and drag the header back or forth over the header area and release the mouse over the header of the desired destination (for multiple rows or columns, select them first). The row or column that is being moved is shown in a transparent clone attached to the pointer, as shown in this figure, where the fourth column is being moved to the left.
![Moving a Column by Dragging](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/dragmove-example.png)

## Moving the Row or Column in Code

To relocate a row, use the SheetView.[SheetView](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.html) method; to remove multiple rows at a time, use the SheetView.[RemoveRows](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.RemoveRows.html) method. To relocate a column, use the SheetView.[MoveColumn](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.MoveColumn.html) method; to remove multiple columns at a time, use the SheetView.[RemoveColumns](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.RemoveColumns.html) method. Alternatively, you can use the [Move](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Model.DefaultSheetAxisModel.Move.html) method of the [DefaultSheetAxisModel](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Model.DefaultSheetAxisModel.html) class.
You can use the [GetColumnFromTag](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.GetColumnFromTag.html) method to find columns based on their [Tag](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Column.Tag.html) property, which you can set programmatically to whatever you want. You can do the same with the [Tag](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Column.Tag.html) method for rows.
You can also delete multiple rows with the [Remove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Rows.Remove.html) method of the [Rows](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Rows.html) class which represents a range of rows. Similarly, you can also remove multiple columns with the [Remove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Columns.Remove.html) method of the [Columns](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.Columns.html) class. For example,

```csharp
fpSpread1.Sheets[0].Columns[1, 5].Remove();
```

```vbnet
FpSpread1.Sheets(0).Columns(1, 5).Remove()
```

## Using the Properties Window

1. At design time, in the **Properties** window, select the Spread component.
2. In the **Misc** category, select the **AllowRowMove** or the **AllowColumnMove** property.
3. Click the drop-down arrow to display the choices and select the value (True or False). Repeat this for each property.

## Method to set

Set the [AllowRowMove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowRowMove.html) or [AllowColumnMove](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowColumnMove.html) property for the [FpSpread](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.html) component.

## **Example**

This example allows the user to move columns or rows.

```csharp
fpSpread1.AllowRowMove = true;
fpSpread1.AllowColumnMove = true;
```

```vbnet
fpSpread1.AllowRowMove = True
fpSpread1.AllowColumnMove = True
```

## Using the Spread Designer

1. Select **Spread** from the drop-down combo list located on the top right side of the Designer.
2. From the **Misc** section, select **True** or **False** for **AllowRowMove** or **AllowColumnMove**.
3. From the **File** menu, select **Save and Exit** to save the changes.

## See Also

[Rows and Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol)
[Customizing the Number of Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolnumber)
[Adding a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcoladd)
[Removing a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolremove)
[Showing or Hiding a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolhide)
[Setting the Row Height or Column Width](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolsize)
[Setting Fixed (Frozen) Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-freeze)
[Creating Alternating Rows](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolalt)
[Setting up Preview Rows](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-previewrow)
[Input Data in Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-userentry)
[Rows or Columns That Have Data](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolnonempty)
[Adding a Tag to a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-tags-rowcol)