Magic Polygon
New Member
- Joined
- Aug 20, 2023
- Messages
- 30
- Office Version
- 2019
- Platform
- Windows
Suppose I have column A, like above, and I lengthen the column. It does this:
Instead of this:
In other words, I don't know how to force other dimensions (image and row height) to change to preserve the aspect ratio and fitted framing of the image made by its containing cell.
VBA Code:
'Determine the empty row
EmptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
'Insert and format photo
Set photo = ActiveSheet.Pictures.Insert(ImagePath)
With photo
.Left = ActiveSheet.Cells(EmptyRow, 1).Left
.Top = ActiveSheet.Cells(EmptyRow, 1).Top
With .ShapeRange
.LockAspectRatio = msoTrue
.Width = Cells(EmptyRow, 1).Width
End With
'Set the format of the picture cell
ActiveSheet.Rows(EmptyRow).RowHeight = photo.ShapeRange.Height
.Placement = 1
End With