![]() |
automatically fit an image into merged cells
can anyone tell me how to insert an image into excel so it appears in the
same place every time also so it resizes to the merged cells i have created |
one way:
Insert the image then run this macro. Adjust the cell reference as desired: Public Sub PositionAndScalePic() Dim rArea As Range Dim dFactor As Double Set rArea = ActiveSheet.Range("J5").MergeArea With ActiveSheet.Pictures With .Item(.Count) .Top = rArea.Top .Left = rArea.Left dFactor = rArea.Width / .Width .Width = rArea.Width .Height = .Height * dFactor If .Height rArea.Height Then dFactor = rArea.Height / .Height .Height = rArea.Height .Width = .Width * dFactor End If .Placement = xlMoveAndSize End With End With End Sub In article , "dave" wrote: can anyone tell me how to insert an image into excel so it appears in the same place every time also so it resizes to the merged cells i have created |
All times are GMT +1. The time now is 12:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com