Pasting HTML without Hyperlinks

by Allen Wyatt
(last updated March 1, 2014)

6

When Ron copies a table from his company's website and pastes it into Excel, it takes a good 20 to 30 seconds to complete the paste operation, during which Ron cannot do anything else on his PC. The table is not large; only about 7 columns by 20 rows. It contains a mix of text and numbers, plus some hyperlinks. Ron thinks it may be the hyperlinks that slow down the pasting, as this long delay doesn't happen when performing a similar operation with other websites. Ron doesn't need the hyperlinks to be pasted, and using Paste Special with a non-HTML paste type doesn't provide satisfactory results. He wonders if there is a way (perhaps with a macro) to paste from the Clipboard in HTML format, but without the hyperlinks.

It could very well be that the problem is with the hyperlinks, but the reason that the hyperlinks are slowing it down may not be related to Excel. The first thing you'll want to check is with any third-party firewalls or anti-virus programs on your system. It is possible that they are intercepting the hyperlinks in the paste operation and checking each of them out before allowing the paste to complete. The only way to find out if that is the case is to disable the suspect program just before you do the paste (and you can enable it after the operation).

Within Excel, your options really are limited. You really only have the choices available under Paste Special to get the information into the worksheet. You may not like the way that the information appears if you paste in text format, but you might also try the Match Destination Formatting option to see if it provides more acceptable results.

Finally, it is possible that the culprit isn't the hyperlinks but is related to your workbook recalculating. If there are a lot of formulas and functions used throughout the workbook, pasting will trigger a recalculation of the entire workbook. You can figure out if this is the culprit by simply turning off automatic recalculation (use the Calculation Options tool on the Formulas tab of the ribbon) before doing your paste.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7403) applies to Microsoft Excel 2007, 2010, and 2013.

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

Freezing Word

Does Word freeze up on you? Try these potential solutions.

Discover More

Generating a Count of Word Occurrences

Do you need to know the frequency with which certain words occur in your documents? There is no built-in way to derive this ...

Discover More

Custom Page Numbers on Printouts

Excel is rather weak on giving you control over how page numbers appear on a printout. This is never more apparent than when ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Deleting a Hyperlink

Hyperlinks can be helpful in some worksheets but bothersome in others. Here's how to get rid of any hyperlinks you don't ...

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

Opening Sites in a Browser

You can store all sorts of information in a worksheet, including Web addresses. If you want to open those addresses in a ...

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 8 - 2?

2014-03-10 16:51:49

Mark D

if the issue is that the hyperlink is not wanted in the final version of the Excel file, I found by performing 1 "undo" after pasting (which creates the hyperlink with blue font) removes the linkange and the cell becomes text only. Though this does not address the speed by which the copy is executed, only replaces the hyperlink with text.


2014-03-03 13:09:41

Glenn Case

Another thing: I have tried this with Calculation turned off, with no effect on the slowdown. I have come to the conclusion that it is the hyperlinks causing the slowness.

I have seen this as well when just pasting a single internet hyperlink into a spreadsheet cell. Whenever I do this Excel hangs for several seconds. This behavior started when I switched from 2003 to 2010.


2014-03-03 13:05:22

Glenn Case

I have had similar problems, and in my case Pasting as text or copying to the notepad do not accomplish the needed effect because tables lose their formatting (i.e., instead of each number reading into a separate cell, they end up as a long string in a single cell.)

Pasting with NoHTMLFormatting = True will remove the HTML formats, but is still slow. If I do so, I will post results here.

I have not tried the method suggested by Bryan, but might try that when I get a chance.


2014-03-03 09:22:17

Bryan

@ E. Veit: the description says Ron has the problem when he pastes something into Excel, so clearly your solution won't work if the first step is to paste into Excel. The problem isn't that he wants to remove the hyperlinks, but that he thought the hyperlinks were slowing him down.

@ Allen: would hyperlinks make a difference if automatic calculation were the culprit? If it ONLY slows down when Ron pastes from one website, then clearly automatic calculation can't be the problem here (unless each website gets pasted to different spreadsheets, but my interpretation of the --admittedly vague-- problem statement doesn't bring me to that conclusion).

If Ron determines that simply stripping out the hyperlinks but keeing the rest of the HTML is what he wants, he can use the code on this MSKB article combined with a clever Replace function: http://support.microsoft.com/kb/274326

Another solution might be to create a macro that formats the "paste as text" output to match what he needs.


2014-03-03 04:42:35

Rudra Sharma

Hi,
Why not paste your data not notepad and paste it back to excel? This is very convenient.

With Regards
Rudra


2014-03-02 20:02:23

E. Veit

What I do to avoid this problem is that I paste into a fresh Excel sheet, then I save it as a *.CSV which clears all formatting, links, icons etc. just like saving a Web-Site as *.txt does.
You have to save and close the file. It first appears with all the stuff you don't like to see.

That makes everything quite clean and it works as an Excel should.
Now I copy the data from the CSV in the Excel sheet where I want the data and apply the format I like with the format painter from a previous line or copy.


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.