Removing artifacts from a spreadsheet with VBA

  • Thread starter Brian E McNamee
  • Start date
B

Brian E McNamee

I copy excerpts of HTML tables into spreadsheets and get "artifacts" some of
which respond to clicking to select and then using DELETE or CUT. When the
cell/row they're in is deleted they migrate to the adjcent row/cell. How can
I identify and remove these with VBA? I've tried to "Record Macro" to see
what the genie does, but all he says is: "Selection.Delete" and that doesn't
tell me what was selected! So, it's useless to include it in my code. I
want to get rid of them because the really drag in a lot of something that
slows down processing on the sheet and fattens it considerably!
 
P

Paul

Brian, try this code:



Code:
--------------------


Sub removeShapes()
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
sh.Delete
Next sh
End Sub
 
B

Brian E McNamee

Paul,

This did the trick. Thank you very much. It reduced the time it took to
process one of my speadsheets that was littlered with "shapes" from over 3
hours to ten minutes!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top