Error at end of loop

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
I have this code that deletes objects all with the same name, but once it gets to the end I get an error. Is there a way to either:
A - stop the error from popping up at the end of the code. or
B - Just have the code fade and delete all the objects at the same time

Code:
Do While ActiveSheet.Shapes("lologo1").Visible = True

    With ActiveSheet.Shapes("lologo1")
        rep_countB = 0
        Do
        DoEvents
        ActiveSheet.Shapes.Range(Array("lologo1")).Select
        Selection.ShapeRange.SoftEdge.Radius = Selection.ShapeRange.SoftEdge.Radius + 3
            rep_countB = rep_countB + 1
            timeoutq (0.01)
    Loop Until rep_countB = 6
        ActiveSheet.Shapes.Range(Array("lologo1")).Delete


    End With
    
Loop
 
Sorry, I didn't notice the bit about multiple shapes with the same name. It looks like a design flaw to allow this, and not provide a direct way to count them.

So a blunter instrument than I'd like:

Code:
Const INC = 3

On Error GoTo EndLoop
Do
    With ActiveSheet.Shapes("lologo1")
        For i = .SoftEdge.Radius To 99 Step INC
            .SoftEdge.Radius = i
            timeoutq (0.01)
        Next i
        .Delete
    End With
Loop

EndLoop:

'...
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,224,832
Messages
6,181,234
Members
453,026
Latest member
cknader

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