Sub FitPicsWidth()
Dim sp As Shape
For Each sp In ActiveSheet.Shapes
If sp.Type = msoPicture Then
sp.LockAspectRatio = msoTrue
sp.Top = sp.TopLeftCell.Top
sp.Left = sp.TopLeftCell.Left
sp.Height = sp.TopLeftCell.Height
sp.Width = sp.TopLeftCell.Width
End If
Next
End Sub
[マクロ]比率を維持したまま、セルの縦幅(h)に画像が合わせる
Sub FitPicsHight()
Dim pic As Shape
For Each pic In ActiveSheet.Shapes
With pic.TopLeftCell
pic.LockAspectRatio = msoTrue
pic.Top = .Top
pic.Left = .Left
pic.Width = .Width
pic.Height = .Height
End With
Next
End Sub