Error Handling - 2nd Loop Doesn't Pick It Up

Lewzerrrr

Active Member
Joined
Jan 18, 2017
Messages
256
** RESOLVED with Resume ResumeCode under "rngPicPosition = "IMAGE UNAVAILABLE""


Hi,

I'm trying to import a picture using an URL, if the picture isn't found then go to my Error Handling code. Which works fine on the first loop but then fails on the 2nd +.

Any suggestions? I'm 100% sure it's the easiest thing probably like an On Error Goto 0 after where it breaks but I can't seem to figure it out.

Here's the code and the code below is where it will break.


Code:
                    With Sheets("Template").Cells(iStartRow, iStartColumn)                                        
                        .Select
                                           
                        On Error GoTo ErrHandler
                        
                        Set Pic = .Parent.Pictures.Insert(URL)
                            
                            With Pic
                                .Top = Pic.Top + 8.7
                                .Left = Pic.Left + 26.1
                                .Width = 92.6929242
                                .Height = 100.629933
                            End With
                        
                        Set Pic = Nothing
                        
                    End With
    
GoTo ResumeCode


ErrHandler:


    rngPicPosition = "Image Unavailable"




ResumeCode:
                'Insert Line No. values e.g. Name, Stock Units, RRP, Units Sold, Cover.
                rngPicPosition.Offset(1, 0) = .Cells(x, 10)

Code:
                        Set Pic = .Parent.Pictures.Insert(URL)

Thanks,
 
Last edited by a moderator:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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