+ Reply to Thread
Results 1 to 2 of 2

VBA Hyperlink

  1. #1
    Registered User
    Join Date
    02-23-2024
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    20

    VBA Hyperlink

    I have an excel sheet that turns tracking #'s into links directed to the carriers page. But it requires use of 3 columns. Column I is the carrier field, Column G is the entered tracking #, and Column H is the link. How could I do this with VBA code and eliminate Column H and have the text entered in Column G function as both manually entered data and the link to track?

    The below formula is what is entered into Column H, which is the column I'd like to remove.

    =IF(I2818="","",IF(ISNUMBER(SEARCH("*FedEx*",I2818)),HYPERLINK("https://www.fedex.com/wtrk/track/?action=track&tracknumbers="&G2818&"&locale=en_US&cntry_code=us",G2818),IF(ISNUMBER(SEARCH("*UPS*",I2818)),HYPERLINK("https://www.ups.com/track?loc=en_US&tracknum="&G2818,G2818),IF(ISNUMBER(SEARCH("*USPS*",I2818)),HYPERLINK("https://tools.usps.com/go/TrackConfirmAction?tRef=fullpage&tLc=2&text28777=&tLabels="&G2818&"%2C&tABt=false",G2818),IF(ISNUMBER(SEARCH("*DHL*",I2818)),HYPERLINK("https://www.dhl.com/us-en/home/tracking/tracking-express.html?submit=1&tracking-id="&G2818,G2818),"Link Unavailable")))))

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,970

    Re: VBA Hyperlink

    Here is some code that will add the link to the tracking number cells, based on the intelligence provided in your formula.

    This assumes your data starts in row 2, and a blank cell in column G indicates end of the data.

    This code will operate on whatever is the active sheet.

    You will have to do your own testing on this. If you provide a sample file I'd be happy to do it.

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. [SOLVED] VBA loop through column and extract embedded hyperlink and create clickable hyperlink
    By Jay S. in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2021, 04:42 PM
  2. userfom load value txtbox hyperlink to cell and create short hyperlink
    By remco77a in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2020, 08:38 AM
  3. Replies: 6
    Last Post: 08-07-2018, 08:43 PM
  4. [SOLVED] With Hyperlink formula & vba, I want to copy text of hyperlink to the cell it's linked to
    By Freakytone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2017, 05:46 PM
  5. [SOLVED] Excel 2010 Create a macro to check if cell contains hyperlink then apply hyperlink style
    By chasidar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 04:48 AM
  6. Replies: 1
    Last Post: 02-23-2013, 05:18 AM
  7. Replies: 20
    Last Post: 03-19-2011, 09:13 AM

Tags for this Thread

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