Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below is my VBA script to dynamically insert and size an image to a merged
cell. My questions are, can I: - scale the image to maximum inside a merged cell, while keeping its original height to width ratio (instead of distorting the image scale to the full merge cell size as it does now)? - change the caption of the command button to "edit image" if an image has been inserted, and change back to "insert image" if nothing is inserted? Any help would be appreciated :-) ------------------------------------------------- Private Sub CommandButton_Click() Dim ImageCell As Range Set ImageCell = Sheet3.Range("B10").MergeArea ' Go to "screen dump" input merged cell (B10:AK30) ImageCell.Select ' Open "Insert Picture" pop-up window Application.Dialogs(xlDialogInsertPicture).Show ' Quite action if nothing is selected On Error Resume Next ' Otherwise size the image selection to full merged cell size With Selection .Left = ImageCell.Left .Top = ImageCell.Top .Width = ImageCell.Width .Height = ImageCell.Height .Placement = xlMoveAndSize End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
autofit text inside merged cells | Excel Discussion (Misc queries) | |||
How can I insert an image inside a comment of a cell? | Excel Discussion (Misc queries) | |||
Code an image viewer inside XL | Excel Programming | |||
Store an image inside a cell? | Excel Worksheet Functions | |||
automatically fit an image into merged cells | Excel Discussion (Misc queries) |