+ Reply to Thread
Results 1 to 3 of 3

Copy and Paste to remove HTML soft hyphen

  1. #1
    Registered User
    Join Date
    06-22-2019
    Location
    Fort Worth, TX
    MS-Off Ver
    2019
    Posts
    1

    Angry Copy and Paste to remove HTML soft hyphen

    I am copying a payment confirmation number from a web page
    Conf code.png

    When I right click and paste to match destination format it pastes into my spreadsheet with a soft hyphen and looks like this:
    conf formatting.png

    The HTML code on the web page is this:

    shy code.png

    If i paste the same value into the notepad it pastes the hyphen and I can delete it and then paste it back into Excel but that is time consuming.

    I need those numbers to bounce against another spreadsheet to confirm that the confirmation numbers are valid.

    Paste Special of the worksheet class will remove html but I am getting a runtime error 1004.



    I just got back into vba after five years off and my html is next to nothing.

    Please be kind!

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Copy and Paste to remove HTML soft hyphen

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy and Paste to remove HTML soft hyphen

    Hello AccountingCop,

    The following code will work on 32 bit versions of Office, which is what I assume you have. If you have a Mac then you are out of luck since the Mac does not support this code.

    Add a new Standard VBA Module to your workbook's VBA Project. Copy all of the code in the attached Notepad file using Ctrl+C and then paste it into your workbook's VBA module with Ctrl+V. Save your changes.

    After you have copied the web data to the clipboard, select the a cell on the worksheet where you want to paste the information. Run the macro CleanHTML. You can select the macro from the Macro Dialog. Use the keys ALT+F8 to display it. This will remove the Soft Hyphen tags from all of the HTML code that you copied to the clipboard. The macro will then paste the rendered HTML data to the worksheet's ActiveCell.

    NOTE: Do to forum system security, I cannot post this code directly. That is why I have attached the text file.

    Macro Code in Attached Text File
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Text overflow in a cell - the right way ( Soft hyphen )
    By lord anubis in forum Excel General
    Replies: 5
    Last Post: 05-30-2018, 12:10 PM
  2. How to Fix HTML Copy & Paste when Posting?
    By omaral in forum Excel General
    Replies: 5
    Last Post: 04-22-2018, 04:05 AM
  3. Replies: 4
    Last Post: 08-11-2016, 11:25 AM
  4. Copy/paste HTML to EXCEL
    By David74747 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-19-2010, 08:50 PM
  5. Remove HTML tags in 1 column, and copy into 2nd
    By streetsoldier707 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2009, 03:34 AM
  6. Replies: 4
    Last Post: 03-02-2005, 12:06 PM
  7. [SOLVED] Need to remove hyphen in group of #s
    By [email protected] in forum Excel General
    Replies: 2
    Last Post: 03-02-2005, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1