Written by Allen Wyatt (last updated January 24, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
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:
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.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6951) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Get Rid of Web Stuff.
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!
When creating an e-mail address hyperlink using the Insert Hyperlink dialog box, Excel allows you to enter a subject for ...
Discover MoreCreating a drop-down list with Excel's data validation feature can be a nice touch for a worksheet. What if you want the ...
Discover MoreNeed to get rid of all the hyperlinks in a worksheet? It's easy when you use this single-line macro.
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2023 Sharon Parq Associates, Inc.
Comments