Sunteți pe pagina 1din 7

How to resize pictures to fit cells in Excel?

Home

Home

Products

Documents

Download

Excel

Purchase

Support

Languages

How to resize pictures to fit cells in Excel?

How to resize pictures to fit cells in Excel?


Normally inserted pictures floats over cells, and most of time one pictures covers a lot of cells. If a worksheet has a large number of pictures, you may want to
put each picture into a single cell. But how to deal with it? Actually, there are several tricky ways to help us resize pictures to fit cells' size quickly.
Resize a selected picture to fit a single cell with VB Macro
Resize inserted pictures to fit cells with Kutools for Excel

Recommended Productivity Software


Office Tab: Use tabbed interface in Office as the use of web browser Chrome, Firefox and Internet Explorer.
Kutools for Excel: Adds 120 powerful new features to Excel. Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Brings back your familiar menus to Office 2007, 2010 and 2013 (includes Office 365).
Resize a selected picture to fit a single cell with VB Macro

Amazing! Using Tabs in Excel like

Hint

How to be
more efficient
and save time when using Excel?
Firefox, Chrome, Internet Explore 10!

We can apply VB macros to resize a selected picture to fit a single cell, but not manually resize a picture's width and height. You can do it with following steps:
Step 1: Insert the pictures in to a worksheet, and select a picture that you will resize it to fit a single cell.

http://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html[8/12/2015 12:04:08 PM]

How to resize pictures to fit cells in Excel?

Step 2: Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
Step 3: Click Insert > Module, and paste the following macro in the Module Window.
VBA: Resize a selected picture to fit a cell.
1 Public Sub FitPic()
2 On Error GoTo NOT_SHAPE
3 Dim PicWtoHRatio As Single
4 Dim CellWtoHRatio As Single
5 With Selection
6 PicWtoHRatio = .Width / .Height
7 End With
8 With Selection.TopLeftCell
9 CellWtoHRatio = .Width / .RowHeight
10 End With
11 Select Case PicWtoHRatio / CellWtoHRatio
12 Case Is > 1
13 With Selection
14 .Width = .TopLeftCell.Width
15 .Height = .Width / PicWtoHRatio
16 End With
17 Case Else
18 With Selection
19 .Height = .TopLeftCell.RowHeight
20 .Width = .Height * PicWtoHRatio
21 End With
22 End Select
23 With Selection
24 .Top = .TopLeftCell.Top
25 .Left = .TopLeftCell.Left
26 End With
27 Exit Sub
28 NOT_SHAPE:
29 MsgBox "Select a picture before running this macro."
30 End Sub
Step 4: Press the F5 key to run this macro.
Step 5: Repeat the steps above to resize other pictures to fit single cell.

http://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html[8/12/2015 12:04:08 PM]

How to resize pictures to fit cells in Excel?

Now all inserted pictures are resized and fits into cells. See the following screenshot:

Note: You can resize only one picture one time. If you select more than one picture one time, a warning dialog box will pop up.
Resize inserted pictures to fit cells with Kutools for Excel
If you have Kutools for Excel installed, you can apply its Import Pictures tool to resize all pictures to fit cells or with fixed height during inserting pictures.
Kutools for Excel includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Get it Now.
Step 1: Select the range cells you want to insert pictures and click the Enterprise >Import/Export > Import Pictures. See the following screenshot:

Step 2: In the Import Pictures dialog box, select the inserting order in the drop-down list, and click Add button to add pictures you need from file or folder, then
click Size button. See screenshot:

http://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html[8/12/2015 12:04:08 PM]

How to resize pictures to fit cells in Excel?

Step 3: Check Matching cell size option. Then click Ok > Import to close dialogs. See screenshot:

Now you can see the pictures are inserted to fit the cells.

Note: You also can specify the cell height and width in step 3 to resize the pictures.

http://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html[8/12/2015 12:04:08 PM]

How to resize pictures to fit cells in Excel?

If you want to know more about this Import Picture feature, please visit here.

Related Article:
How to resize multiple cells to fit pictures above them quickly in Excel?

Is your problem solved?


Yes, I want to be more efficiency and save time when using Excel No, the problem persists and I need further support
Recommended Productivity Tools
The following tools will greatly save your time and effort, which one do you prefer?
Office Tab: Using handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: 120 powerful new functions for Excel, Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Bring back familiar menus to Office 2007, 2010, 2013 and 365, as if it were Office 2000 and 2003.

Kutools for Excel


Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!
More than 120 powerful advanced functions which designed for Excel:
Merge Cell/Rows/Columns without Losing Data.
Combine and Consolidate Multiple Sheets and Workbooks.
Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

http://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html[8/12/2015 12:04:08 PM]

How to resize pictures to fit cells in Excel?

Comments
0 # Jim Abramczyk 2014-03-23 19:55
FitPic macro noted above is Sweeeeeet!
I took a bunch of pictures of garage sale items that eventually went to Salvation Army. I documented pictures and values in Excel tax purposes. This macro
worked first time!
Reply | Reply with quote | Quote
0 # lucy 2014-05-29 16:39
Instructions for Excel
Reply | Reply with quote | Quote
0 # Monika 2014-11-03 15:35
Thank you this was perfect!!
Reply | Reply with quote | Quote
0 # Marcelo 2015-07-06 13:38
Works!!
But i have one question, i want to fit a img in a range of cells merged, how can i do it?
Reply | Reply with quote | Quote
Refresh comments list
Add comment

Name (required)

http://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html[8/12/2015 12:04:08 PM]

How to resize pictures to fit cells in Excel?

E-mail (required, but will not display)

2000 symbols left


Notify me of follow-up comments

Refresh

Send
Home
Documents
Support
Privacy Policy
Contact Us
Copyright 2009 - 2015 ExtendOffice.com | All Rights Reserved.
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.

http://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html[8/12/2015 12:04:08 PM]

S-ar putea să vă placă și