VBA : Error Code When Adjust The Range

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi guys..

i need your help, this code not stable i have modify this code in the other sheet but still error..
here this code :
Code:
[COLOR=#333333]Sub Test2()[/COLOR]<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Dim indx As Long
Dim cellFrames As Variant
Dim Pic As Shape

    indx = 4
    For Each cellFrames In Range("$F$84:$M$87,$O$84:$V$87,$X$84:$AD$87,$AG$84:$AM$87").Areas
        Set Pic = ActiveSheet.Shapes(indx)
        If Pic.Type = msoPicture Then
            Pic.Height = cellFrames.Height
            Pic.Left = cellFrames.Left + ((cellFrames.Width - Pic.Width) / 2)
            Pic.Top = cellFrames.Top
            indx = indx + 1
        End If
        Set Pic = Nothing
    Next </code>[COLOR=#333333]End Sub[/COLOR]

the problem only 2 pictures can move and placing in the right place (in frame/box available) and 2 picture the other not move & not resize
i want all picture (4 picture) can move, resize, and "in" that frame/box...
how to fixed it..

this a cross post from https://www.excelforum.com/excel-pr...672-resize-and-placing-image-error-400-a.html

i hope someone would help me out?

here this example xlsx file :

http://bit.ly/2zHe9Jy

any assistance, much appreciated..

m.susanto
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,214,654
Messages
6,120,758
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top