Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Get Rid of Web Stuff.

Get Rid of Web Stuff

by Allen Wyatt
(last updated September 7, 2013)

17

Grant regularly copies information from Web pages and pastes that information into worksheets. He ends up not only with raw data, but also with other items, such as checkboxes, pictures, logos, etc. Grant wants an easy way to get rid of all these non-data items.

The first thing that most people try is to use Go To Special, in this manner:

  1. Press F5. Excel displays the Go To dialog box.
  2. Click the Special button. Excel displays the Go To Special dialog box. (See Figure 1.)
  3. Figure 1. The Go To Special dialog box.

  4. Select the Objects option.
  5. Click OK.

When you do this, Excel selects a number of the objects in the worksheet, and you can then press the Delete key to get rid of them. The problem is that this method doesn't select all the non-data items in the worksheet; it only selects a subset of them—those items that are considered "objects" by Excel.

A better solution is to use a macro to select all the shapes in the worksheet and then delete them. This is fairly simple to do, using a macro like this one:

Sub DeleteAllShapes1()
    Dim shp As Shape
    For Each shp In ActiveSheet.Shapes
        shp.Delete
    Next
End Sub

The macro just loops thru each shape on the active worksheet and deletes each one. You could expand on the macro just a bit by having it also delete all the hyperlinks that are pasted in the worksheet. All it takes is the addition of a single line:

Sub DeleteAllShapes2()
    Dim shp As Shape
    For Each shp In ActiveSheet.Shapes
        shp.Delete
    Next
    ActiveSheet.Hyperlinks.Delete
End Sub

If, for some strange reason, these macros don't get rid of all the non-data items you want removed, there is another approach you can use: make a stop in NotePad before Excel. Simply paste your Web data into a blank NotePad document, then select that information (after it is pasted) and copy it back to the Clipboard. Then, paste it into Excel. The only thing that is left should be straight data.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2881) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Get Rid of Web Stuff.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Aligning Positive and Negative Whole Numbers in a Column

When you use a table to present numeric information, you may want to have Word align the numbers in the table. This can be a ...

Discover More

Trouble Recording Paste Special Formula

Sometimes, when you upgrade to a new version of Excel, you could run into a problem recording macros that you had no problem ...

Discover More

Getting Rid of Leading Zeros in a Number Format

Excel, by default, displays numbers with a leading zero, if they are less than 1. Here's how you can get rid of those leading ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (menu)

Hyperlinks that Open in a Different Browser Window

When you click a link in a browser, the target of that link might open in the same window or in a new window. Getting an ...

Discover More

Specifying a Browser in a Hyperlink

Excel allows you to easily add hyperlinks to a worksheet. Click on it, and the target of the link is opened in a browser ...

Discover More

Linking to a Specific Page in a PDF File

The HYPERLINK function is great for linking to Web pages and some other resources, but it won't allow you to access a target ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 7?

2017-05-09 10:39:03

Yatin

Thank you for this tip. This worked amazingly well at speeding up my excel file. Thank you once again. Microsoft was useless at giving me a solution for this!


2017-03-03 09:51:58

John Drohan

That you for this post. The first macro worked like a charm. Thank you.


2016-11-07 16:08:45

mark

The F5 tip shown in Figure 1 was enough for me! I had javascript objects I couldn't get rid of. I didn't need the macro but it looks cool! THANKS!


2016-05-27 09:17:18

Margaret

This worked perfectly. Thank you.


2016-03-07 17:32:21

Achates

Thanks a lot.


2016-01-08 18:18:05

Denise

After trying the Microsoft NON-solution - thank you for helping me get rid of those javascript links!


2015-08-20 15:27:45

Melanie

OMG this is fantastic. I have always tried to copy out of our company's directory into a spreadsheet but it always brings in three columns of icons-- and I've never found an easy way to get rid of them. Three clicks and Gone? The Go-to Special, Objects, Delete key worked in Office 2013 too!


2015-07-24 16:30:29

howard

Thank you ! My Excel spreadsheet got bogged down with embedded javascript links. The response time was so bad until I got this tip to remove the unwanted object.


2015-06-11 14:36:38

Jacqueline

Thank you for saving me from enormous aggravation and loss of productivity. After reading this tip, it took two seconds to remove something that has been frustrating me for a half hour.


2015-06-05 02:44:10

pratap

thanks a lot allen.
it saved my day


2015-04-14 10:12:13

dvs

Exactly what I needed. Thanks!


2015-04-02 09:49:39

Chiranjiv

Thanks a lot for this tip. Really helped. Cheers!


2015-02-18 08:10:39

Balram

It really helped after spending an hour or so with other solutions. This object was copied and pasted from web into an excel sheet.


2014-12-15 04:00:35

belgiumpma

thanks a lot ! work fine !


2014-12-09 12:39:10

Rick A

I used your DeleteAllShapes2 and Delete Hyperlinks Macro and it worked like a charm. My workbook was really bogged down.

Thanka a lot for the help!

Rick


2014-06-27 12:05:32

Shai

Hi Allen,

Thanks for the article.

I have a question though.

I am using multiple web broswers(1 for each day in our weekly report so total of 5). For some of our days there are no campaigns hence there won't be any url for
that day. However I will come to know only when the report is run. IS there a way to delete just few of the web browsers out of the 5 that I have. The number of web browsers to delete for a particular week may be 1,2,3 or 4 which I will come to know only after I run the report.


2014-05-21 01:23:04

Vivek K

Thanks, for the pro advise it really helped me.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.