This article was co-authored by wikiHow staff writer, Rain Kengly. Rain Kengly is a wikiHow Technology Writer. As a storytelling enthusiast with a penchant for technology, they hope to create long-lasting connections with readers from all around the globe. Rain graduated from San Francisco State University with a BA in Cinema.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 252,600 times.
Learn more...
Do you have an image or logo that you want to add to your Excel sheet to make it more visually appealing? You can easily use the Insert menu or a VBA formula to automatically resize your images when you add them to a cell. Here's how to insert pictures in Excel that automatically size to fit cells using your Windows or Mac computer.
Sizing Pictures to Fit Cells in Excel
To add a picture that automatically fits cells in Excel, click Insert > Pictures > Place in Cell > This Device > select a picture. If you decide to resize the cell, the picture will resize with it.
Steps
-
Click Insert. This is the tab at the top, between Home and Page Layout.[1]
-
Click Pictures. You can find this in the Illustrations section.
- A drop-down menu will open.
Advertisement -
Hover over "Place in Cell". This is the option that allows pictures to follow the size of the cell.
-
Click This Device…. Alternatively, you can select Stock Images to browse Microsoft's images or Online Pictures to search the web via Bing.
-
Select a picture and click Insert. The picture will be added to the cell. It will automatically fit the current size of the cell.
- If you change the cell size, the picture will become bigger or smaller with it.
-
Press Alt+F11. This opens the VBA (Visual Basic for Applications) menu.
- If you inserted a picture and it isn't resizing automatically, you can use this code instead.
-
Click Insert. This is in the top toolbar.
-
Click Module. You can find this in the drop-down menu. A new window will open.
-
Copy and paste the code. Use the following code:
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
- Press F5 to run the code and repeat this process until all the images in your sheet fit into cells.
Community Q&A
-
QuestionWhen I resize a picture to a smaller cell and then restore it, I lose the detail. How can I avoid this?CJ89483Community AnswerWhen you resize an image to a smaller size and then restore it to its original size, the image may lose some of its detail and sharpness. To avoid this, it is best to start with the original high-resolution image and use good-quality resizing software that includes bicubic interpolation. Bicubic interpolation is a resizing method that helps preserve detail and sharpness in the image. It is also important to avoid resizing the image too much and to save a copy of the original image. By following these tips, you can help ensure that your images retain their detail and quality when resized.
Video
Tips
References
About This Article
1. Open your project in Microsoft Excel.
2. Insert an image.
3. Resize it.
4. Lock the image to the cell.