I've created some arrows dynamically in an Excel sheet. How am i to delete / clear them off. I'm using a menu command for tat..Pls help. Thank u very much.
Printable View
I've created some arrows dynamically in an Excel sheet. How am i to delete / clear them off. I'm using a menu command for tat..Pls help. Thank u very much.
That'S easy.
Your arrows are shapes, so clear all shapes
Works, if the Sheet is activated!
VB Code:
Sub Clear_Shapes() Dim i As Integer Dim j As Integer i = ActiveSheet.Shapes.Count For j = 1 To i 'Must be Shape(1) since they are renumbered after each Delete command! ActiveSheet.Shapes(1).Select Selection.Delete Next j End Sub
"learned" that using the Macro-Recorder, you could have done it yourself!
Opus..I found errors in ur solution but I do not know how to solve it.However, I've got the solution and it is:
ActiveSheet.DrawingObjects.Delete
It works man!!!!! :D
Errors???
How did you doo ther arrows?, aren't they Shapes?
That's y i told u that they were created dynamically(slightly different) for the blk view against periods.a bit complex.Its alright since its done. ;)
This is how I did it...
http://www.vbforums.com/showthread.p...hreadid=237554
Hi Opus..Spajeoly has given a link to his code. His is very very similar to yours... I tried his can work but not urs.. Its gd tat if u could go n have a look at Spajeoly's solution jus for info.;)
I don'T realy se a reason why Spajeoly'S code should run better than mine????
His should get same Errors I saw. He covering them with a On Error Resume Next, I made the adjustment in the loop (deleting Shape(1) all the time).
But I like your version, a one liner, and a couldn't find that one in the Help, damn!!
LoL, amazing what that code can do eh @ On Error Resume Next.
It was the best way to bypass that error but learning that this can be done in one line is kind of irritating lol.
Oh well, this is how we all learn eh?