Are you looking to enhance your Excel spreadsheet by adding images or logos to make it more visually engaging? While Excel doesn't offer an automatic feature to resize images within cells, you can easily achieve this with just a few clicks. Today, Mytour will guide you through the process of inserting images into Excel and adjusting their size to fit perfectly within the cells.
Steps

Open your project in Microsoft Excel. You can do this by navigating to File > Open directly in Excel, or right-clicking on the project file and selecting Open with > Excel.

Insert the image. To do this, go to Insert > Pictures > select the image > Insert.

Adjust the size. Once the image is selected, the "Size" options group will appear under the "Format" and "Picture Tools" tabs.
- Modify the Height and Width parameters, or drag and drop the corners of the image to resize it.

Lock the image to the cell. By default, the image you added will "float" above the cells and won't resize with them. To fix this, you need to lock the image or the cell.
- Right-click the image and select Format Picture. Then, click on the "Size & Properties" tab (the green square icon with multi-directional arrows) and choose Move and size with cells.
- You can also use the following VBA code after inserting some images. Insert the image, then press Alt + F11 to open the VBA window. Click Insert > Module and paste the following code:
- Press F5 to execute the code and repeat the process until all images in the spreadsheet fit the cells.
Public Sub FitPic() On Error GoTo NOT_SHAPE Dim PicWtoHRatio As Single Dim CellWtoHRatio As Single With Selection PicWtoHRatio = .Width / .Height End With With Selection.TopLeftCell CellWtoHRatio = .Width / .RowHeight End With Select Case PicWtoHRatio / CellWtoHRatio Case Is > 1 With Selection .Width = .TopLeftCell.Width .Height = .Width / PicWtoHRatio End With Case Else With Selection .Height = .TopLeftCell.RowHeight .Width = .Height * PicWtoHRatio End With End Select With Selection .Top = .TopLeftCell.Top .Left = .TopLeftCell.Left End With Exit Sub NOT_SHAPE: MsgBox "Select a picture before running this macro." End Sub