Prevent Excel Pictures from Moving to Wrong Rows After Sorting
Question details
The user needs to prevent images from misaligning or moving to incorrect rows when sorting a dataset.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Sorting a dataset that contains images embedded within the rows.
- Observed behavior
- Pictures become associated with the wrong records or jumble together after sorting the data, even when set to move with cells.
Ensure that every picture is scaled to fit entirely within its respective cell borders without overlapping any edges, as overlapping can detach the image from the row during a sort.
Verify Cell Boundaries and Picture Properties
Ensure that each picture is perfectly contained within its cell and has the correct property settings to move along with the row data.
For Excel to associate a picture with a specific row during a sort, the image must not touch or cross the cell borders. Even a slight overlap can cause the picture to stay behind or move unpredictably.
Click and drag the sizing handles on your picture to resize it so that it fits entirely within the cell boundaries, leaving a small gap between the image and the cell edges.
Right-click the image and select 'Format Picture' from the context menu to open the formatting pane on the right side of the screen.
Click the 'Size & Properties' icon in the formatting pane, expand the 'Properties' section, and select the radio button for 'Move but don't size with cells'.
Highlight your entire dataset, explicitly including the column that contains the pictures, before applying your custom sort order.

Group Related Pictures
Grouping multiple related pictures together can prevent them from jumbling or moving independently when the data is sorted.
Sort Data First or Reposition using VBA
If native cell anchoring continues to fail, change your workflow order or use a macro to maintain precise image positioning.
Easily Sort Spreadsheets with Embedded Images Using WPS Office
WPS Spreadsheet offers robust handling of embedded objects, ensuring your pictures stay securely attached to their corresponding rows when organizing or sorting complex datasets. Say goodbye to misaligned layouts and tedious manual adjustments.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your dataset containing the text and images.
- 2. Adjust and insert pictures: Insert your pictures into the desired column, ensuring each image strictly stays within its cell boundaries.
- 3. Set object properties: Right-click the images, select 'Format Object', navigate to Properties, and choose 'Move and size with cells'.
- 4. Sort your data safely: Highlight your entire data range and click 'Sort' under the Data tab. The images will flawlessly move with their corresponding rows.

Frequently Asked Questions
Why do my pictures overlap or bunch up at the top after sorting in Excel?
This typically occurs if the pictures overlap the cell borders slightly, or if the 'Don't move or size with cells' property is enabled in the image's formatting options.
Does resizing the row automatically resize the picture inside it?
Only if you select the 'Move and size with cells' option in the Format Picture properties menu. Otherwise, the image will retain its original dimensions regardless of row height.
How can I ensure the sort range includes my images?
Instead of selecting just a single column of text to sort, manually highlight the entire data table block—explicitly including the column containing your pictures—before applying the sort order.




