TryenErrorenGoodenLk
New Member
- Joined
- May 9, 2018
- Messages
- 5
Please Gurus,
Help me change this formula, I want the size of the image which is inserted is to be exactly the size I wanted (or automatically as big as the size of the cell). Thanks in advance
Help me change this formula, I want the size of the image which is inserted is to be exactly the size I wanted (or automatically as big as the size of the cell). Thanks in advance
VBA Code:
Sub INSERT_PICTURE_DIALOG()
'---------------------------------------------------------------------------
'- SELECTED CELL
Dim MyCell As Range
Set MyCell = ActiveCell
'---------------------------------------------------------------------------
'- EXCEL INSERT PICTURE DIALOG. **AUTOMATIC INSERTION**.
rsp = Application.Dialogs(xlDialogInsertPicture).Show
If rsp = False Then Exit Sub
'---------------------------------------------------------------------------
'- RESIZE PICTURE TO CELL. CHANGE ITS NAME. REFORMAT
With MyCell
.Value = MyFile ' put the file name into the cell
'-
Selection.Name = "MyName"
Selection.Top = .Top
Selection.Left = .Left
Selection.Width = .Width
Selection.Height = .Height
Selection.ShapeRange.PictureFormat.Brightness = 0.5 ' various formats available
Selection.Placement = xlMoveAndSize ' move and size with cells
Selection.PrintObject = True
'-
.Select ' change focus (selection) from picture to cell
End With
'--------------------------------------------------------------------------
Beep
End Sub