sthrncaliguy
Board Regular
- Joined
- Jul 28, 2009
- Messages
- 213
Ok all here is my macro so far..
It does place the image in the correct cell, and technical sizes it correctly, except the cell is a merged cell, but the pic is sized to the actual cell itself, not the merged cell.
Is there any way to modify the above code so that if my Cell V11 is a merged cell, that covers say 5 columns and 10 rows for example, the image would be sized appropriately?
Code:
Sub FitImageToCell()
Dim sPicture As String, pic As Picture, PicName As String
PicName = ActiveSheet.Range("A9").Text
Set pic = ActiveSheet.Pictures(PicName)
With pic
.Left = ActiveSheet.Cells(11, 22).Left
.Top = ActiveSheet.Cells(11, 22).Top
'.Height = ActiveSheet.Cells(11, 22).Height
.Width = ActiveSheet.Cells(11, 22).Width
End With
End Sub
It does place the image in the correct cell, and technical sizes it correctly, except the cell is a merged cell, but the pic is sized to the actual cell itself, not the merged cell.
Is there any way to modify the above code so that if my Cell V11 is a merged cell, that covers say 5 columns and 10 rows for example, the image would be sized appropriately?