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.
by Allen Wyatt
(last updated September 7, 2013)
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:
Figure 1. The Go To Special dialog box.
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.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
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
Make a reference to a hyperlink in a formula, and you may be surprised that the reference doesn't return an active ...Discover More
The HYPERLINK function is great for linking to Web pages and some other resources, but it won't allow you to access a ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.