views
Open your project in Microsoft Excel. You can do this by going to File > Open within Excel or you can right-click the project file and select Open with > Excel.
Insert an image. You can do this by going to Insert > Pictures > Selecting your picture > Insert.
Resize it. When you have the image selected, you'll see a "Size" grouping under "Format" and "Picture Tools." Change the Height and Width to adjust the size of your image. Instead, you can drag and drop the corners of the image to re-adjust the size.
Lock the image to the cell. By default, the image you added "floats" above your cells and doesn't change size as your cells do. To fix this, you need to lock the image or the cell. Right-click your picture and click Format Picture. Then click the "Size & Properties" tab (a symbol with a green square with arrows around it) and select Move and size with cells. You can also use a VBA code after you've inserted some pictures. Insert the images and press Alt + F11 to open the VBA window. Click Insert > Module and paste 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.
Comments
0 comment