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

Get Rid of Web Stuff

by Allen Wyatt
(last updated June 9, 2018)

5

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.

When you first paste from the Web into an Excel worksheet, you may want to consider using Paste Special to do something like Paste As Text or Paste Values. This should help preclude getting those unwanted objects into your worksheet in the first place.

If Paste Special doesn't give the desired results or if you are working with a worksheet into which the information and objects have already been pasted, there are a few things you can try. 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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6951) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel 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

Automatic Recalculation Not Happening

Excel 97, under certain circumstances, has a problem recalculating worksheets reliably. This tip tells you how to patch ...

Discover More

Drawing a Curve

Ever wonder how to add a curved line to your document? With a little practice, adding curves is simple. Here's how.

Discover More

Deleting Old Data from a Worksheet

If you keep on-going data in a worksheet, some of your dataâ€"over timeâ€"may need to be deleted. If you have an ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Pulling Apart a URL

Excel provides a good number of worksheet functions that can help you pick apart text strings in various ways. In this ...

Discover More

Opening an HTML Page in a Macro

Excel allows you to open HTML pages within the program, which is great for some purposes. What if you want to open a ...

Discover More

Hyperlinks in Comments

Need to add a hyperlink to a comment? It's easy to do by following the steps outlined in this tip.

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. Maximum image size is 6Mpixels. 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 5 + 2?

2018-06-12 08:16:43

Alex B

If you just want a table from a webpage, power query's Get data > from other sources > from web, does a pretty good job.


2018-06-12 07:22:29

Alex B

Instead of using Go To > select objects, I think it's quicker to select 1 of the objects and hit Ctrl+A. This will select all the objects. You can hit the delete key.


2018-06-11 13:35:00

Chris

A further comment because I have just had occasion to copy a table from a website and paste it into Excel. I tried using Paste Special; it worked, BUT the table structure was lost. I therefore fell back on my old method:
Paste it into a new (scratch) sheet (Ctrl-V)
Ctrl-C to replace the contents of the clipboard (not HTML any more). Note that the table as pasted is already selected, so Ctrl-C is sufficient.
Now go to where you want the table and Paste Special to get the table unformatted but with structure.


2018-06-09 10:13:55

J. Woolley

I like PureText (http://stevemiller.net/PureText). It is useful anywhere, not just Excel. The result is similar to your Notepad trick.


2018-06-09 05:20:39

Chris

Thanks for the tip; up till now I had assumed that paste special only worked with clipboard contents that originated in Excel.
If I am working with a worksheet into which the information and objects have already been pasted, I select them and use Paste Special to paste them where I want them.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.