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.
    • A drop-down menu will open.
    Advertisement
  3. This is the option that allows pictures to follow the size of the cell.
  4. Alternatively, you can select Stock Images to browse Microsoft's images or Online Pictures to search the web via Bing.
  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

Merge Cells in Excel Merge Cells in Microsoft Excel: A Quick Guide
Unprotect an Excel SheetUnprotect an Excel Sheet
Unhide All Rows and Columns in Microsoft Excel
Use If‐Else in Excel Use If‐Else in Microsoft Excel: Step-by-Step Tutorial
Create a Mortgage Calculator With Microsoft ExcelCreate a Mortgage Calculator With Microsoft Excel
Create a Graph in Excel Create a Graph in Excel
Unhide Columns in Excel Show Hidden Columns in Microsoft Excel & Unhide Column A
Ethernet Doesn't Have a Valid IP Configuration Fix Ethernet Doesn't Have a Valid IP Configuration on Windows
Freeze Cells in Excel3 Easy Ways to Freeze Panes to Lock Columns or Rows in Excel
Change from Lowercase to Uppercase in Excel Change from Lowercase to Uppercase in Microsoft Excel
Make a Spreadsheet in ExcelMake a Spreadsheet in Excel
Use ExcelNew to Excel? Here's Super Easy Tricks to Get You Started
Link Sheets in ExcelLink Sheets in Excel
Make a List Within a Cell in ExcelThe Best Ways to Make & Format Lists in Excel
Advertisement

About This Article

Rain Kengly
Written by:
wikiHow Technology Writer
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 viewed 252,600 times.
How helpful is this?
Co-authors: 7
Updated: December 20, 2024
Views: 252,600
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 252,600 times.

Is this article up to date?

Advertisement