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.
Note:
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.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
When you create a worksheet that is destined for viewing on the Web, you will want to specify the monitor resolution you ...
Discover MoreExcel allows you to easily add hyperlinks to a worksheet. Click on it, and the target of the link is opened in a browser ...
Discover MoreThe HYPERLINK function is great for linking to Web pages and some other resources, but it won't allow you to access a ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-05-19 11:07:27
Nuno
Amazing solution!
2019-12-25 12:24:21
Siddhi Jain
Thanks a lot! It worked.
2019-11-28 21:00:28
Matt
Champion! That text-box was driving me nuts. Works in Excel 365.
2018-10-13 15:48:59
John Easterwood
Pressed F5, Select, Objects and all Objects were selected, but when I tried to select objects to be deleted, selection went away without deleting the object. Need a way to select some but not all of the objects. Thanks.
2018-07-14 23:51:02
Paul Muresan
Great! I thought it was somthing complicated but solved all my problems.
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.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2021 Sharon Parq Associates, Inc.
Comments