hello
i try writing code to remove all of shapes are existed in col a but i failed it gives me error and i search in the internet i have found remove all of shapes in sheet
this is my trying
hello
i try writing code to remove all of shapes are existed in col a but i failed it gives me error and i search in the internet i have found remove all of shapes in sheet
this is my trying
HI, rory it gives me error
I setup my buttons to fit into cells, then tried using intersect method to delete the same shapes, yet some shapes remained. My solution was to name my shapes with the column and row in the shape names, then when I wanted to delete the shapes, loop through all shapes, deleting the shapes per the text in the shape names.
'This code deletes shapes based on text in the shape names that identifies row and column.
Sub DeleteShapesInColumn2()
Dim shp As shape
Dim sh As Worksheet
`'Loop through all the shapes on the sheet, delete all with Col02 in shape name
Set sh = ThisWorkbook.Worksheets("mySheet")
If sh.Shapes.Count > 0 Then
For Each shp In sh.Shapes
If InStr(shp.Name, "Col02") Then
shp.delete
End If
Next shp
End If
End Sub
Display More
thanks dwlott for your try honestly i no know how your code works i do not see any thing related the col a i run the macro doesn't happen any change
Attach an example file
astonishing jolivanes it works like charm thanks so much
hi, RoyUk i have ever attached my file in post#3
hi, jolivanes,RoyUK I would ask if is possible specify the range like a2:c100 instead of col 1 i try adjusting in this line but it gives me error
If shp.Range("a2:c100") = 1 Then shp.Delete
thanks jolivanes for your codes they work excellently
Glad it works.
You have to say thanks to rory for that last one.
Thanks for letting us know.
hi, jolivanes i hope to don't misunderstand me i don't ignore Rory deliberately
He always solves many problems especially difficulty every time i issue my thread i find him the first person helps , i appreciate him
thanks all
Good on you but that is not what I meant.
The code in post #11 is more or less what rory supplied in post #2.
Don’t have an account yet? Register yourself now and be a part of our community!