PDF download Download Article
Automate image sizes to fit in cells
PDF download Download Article

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.

Method 1
Method 1 of 2:

Using the Insert Menu

PDF download Download Article
  1. This is the tab at the top, between Home and Page Layout.[1]
  2. You can find this in the Illustrations section.
    • If you don't see the menu, click the Illustrations icon first, or expand your Excel window.
    Advertisement
  3. This is the option that allows pictures to follow the size of the cell.
    • You can skip this step if you are using the web browser version of Excel.
  4. Alternatively, you can select Stock Images to browse Microsoft's images or Online Pictures to search the web via Bing.
    • If you don't see this option, select Picture from File... instead.
  5. The picture will be added to the cell. It will automatically fit the current size of the cell.
  6. Advertisement
Method 2
Method 2 of 2:

Using a VBA Code

PDF download Download Article
  1. This opens the VBA (Visual Basic for Applications) menu.
    1. If you inserted a picture and it isn't resizing automatically, you can use this code instead.
  2. This is in the top toolbar.
  3. You can find this in the drop-down menu. A new window will open.
  4. 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
    
    1. Press F5 to run the code and repeat this process until all the images in your sheet fit into cells.
  5. Advertisement

Community Q&A

Search
Add New Question
  • Question
    When I resize a picture to a smaller cell and then restore it, I lose the detail. How can I avoid this?
    CJ89483
    CJ89483
    Community Answer
    When 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.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Video

Tips

Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!

You Might Also Like

Adjust Cell Size in ExcelMicrosoft Excel: 5 Ways to Enlarge Cells in Your Spreadsheet
Add Images to a PowerPoint Presentation4 Simple Ways to Insert a Picture in PowerPoint
Add Images to a Microsoft Word Document Add Images to a Microsoft Word Document: Windows, Mac, Web Guide
Insert an Object in ExcelInsert an Object in Excel
Embed Pictures Embed Images in Documents and Websites
Embed Documents in ExcelEasily Embed Documents and Files in an Excel Spreadsheet
Copy a Graph from Excel to PowerPoint Copy a Graph from Excel to PowerPoint
Add an Image in Word Insert an Image in Microsoft Word: Best Tips & Tricks
Crop a Picture in Word Crop a Photo in Word: 4 Quick & Easy Ways
Make Any Picture Your Computer's Wallpaper Set Any Picture Your Computer's Wallpaper: Full Guide
Keep Text in One Cell in Excel Keep Text in One Cell in Excel
Delete All Images in Excel Quickly Delete All Images in Excel in 3 Steps
Automatically Reduce the Size of Pictures Included in an Email Message Reduce the Size of Pictures Included in an Email Message
Anchor an Image in WordAnchor an Image in Word
Advertisement

About This Article

Stan Kats
Reviewed by:
Professional Technologist
This article was reviewed by Stan Kats and by wikiHow staff writer, Rain Kengly. Stan Kats is a Professional Technologist and the COO and Chief Technologist for The STG IT Consulting Group in West Hollywood, California. Stan provides comprehensive technology solutions to businesses through managed IT services, and for individuals through his consumer service business, Stan's Tech Garage. Stan holds a BA in International Relations from The University of Southern California. He began his career working in the Fortune 500 IT world. Stan founded his companies to offer an enterprise-level of expertise for small businesses and individuals. This article has been viewed 279,802 times.
How helpful is this?
Co-authors: 7
Updated: April 21, 2025
Views: 279,802
Categories: Microsoft Excel
Article SummaryX

1. Open your project in Microsoft Excel.
2. Insert an image.
3. Resize it.
4. Lock the image to the cell.

Did this summary help you?

Thanks to all authors for creating a page that has been read 279,802 times.

Is this article up to date?

Advertisement