Results 1 to 10 of 10

Resize picture to fit merged cell

Threaded View

  1. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Resize picture to fit merged cell

    try this
    Sub ResizePic()
    Dim r As Range, lTop As Long, lLeft As Long, lHeight As Long, lWidth As Long, shp As Shape
    On Error Resume Next: Err.Clear
    Set r = Application.InputBox("Click in the cell to hold the picture", Type:=8)
    If Err Then Exit Sub
    
    With r.MergeArea
        lTop = .Top
        lLeft = .Left
        lHeight = .Height
        lWidth = .Width
    End With
    
    For Each shp In ActiveSheet.Shapes
        If Not Intersect(shp.TopLeftCell, r.MergeArea) Is Nothing Then
            With shp
                .LockAspectRatio = msoFalse
                .Top = lTop
                .Left = lLeft
                .Height = lHeight
                .Width = lWidth
            End With
        End If
    Next shp
    
    End Sub
    edited
    oops, I did not read 'from anywhere on the worksheet'
    Last edited by nilem; 08-26-2016 at 11:57 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 03-29-2021, 03:01 AM
  2. Excel VBA to insert & resize picture based on cell url
    By shabeersa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2016, 03:54 AM
  3. Replies: 5
    Last Post: 09-11-2014, 02:30 PM
  4. Insert image and resize to fit merges selected cell (also merged cell)
    By acecarwash in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2014, 09:55 AM
  5. [SOLVED] VBA help to move and resize a picture from one cell to another
    By markharris2004 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2013, 07:04 AM
  6. Auto Resize Pasted Picture to merged cell
    By CyberPath in forum Excel General
    Replies: 2
    Last Post: 04-15-2012, 07:13 AM
  7. Paste picture in & have it resize to merged cells size
    By simonwilliams in forum Excel General
    Replies: 0
    Last Post: 10-02-2011, 03:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1