Prevent auto creation of URLs in Excel

TechRepublic
The behaviour of Microsoft Excel with regard to URLs entered into a cell is to automatically create a clickable hyperlink. However, circumstances may arise in which you want to disable that feature. Preventing the automatic creation of hyperlinks can be accomplished in three dramatically different ways.

Since Excel 2000, the automatic creation of hyperlinks can be disabled by reconfiguring the AutoCorrect settings. Here is the procedure:

  • Navigate to Tools | AutoCorrect options in the Excel menu.
  • Click the AutoFormat As You Type tab.
  • Under Replace As You Type, uncheck Internet And Network Paths With Hyperlinks.

    In Excel 2003, you will also be given the option of turning off this AutoCorrect feature with the action dialog that appears after entering the first URL.

    Entering URLs into a cell as a label will also prevent the automatic creation of a hyperlink in Excel. A label is indicated by preceding the cell entry with an apostrophe. For example, enter a URL as:

  • 'http://zdnet.com.au

    This solution is much more involved then the previous two and uses VBA code. It is a good example of how program-level event handlers in VBA can be used to dynamically change how Excel behaves toward entered data. While this method will certainly disable the automatic creation of hyperlinks in Excel, it may be a little over-the-top for most situations. However, if you need to systematically disable the automatic creation of hyperlinks for some reason, this is probably the best way to ensure it.

    The VBA code is taken directly from the Microsoft Knowledge Base, Article 291209.

    1. Start a new worksheet and start the Microsoft Visual Basic Editor (press ALT+F11).
    2. Insert this VBA code into that module.
    3. Switch to the Project Explorer window and click This Workbook.
    4. Insert this VBA code into that module.
    5. Save the file.
    6. Run the macro.

    Once the macro is run, the automatic creation of hyperlinks is disabled. You can place this macro in the Excel startup folder if you want it to run every time Excel is started.

    TechRepublic is the online community and information resource for all IT professionals, from support staff to executives. We offer in-depth technical articles written for IT professionals by IT professionals. In addition to articles on everything from Windows to e-mail to firewalls, we offer IT industry analysis, downloads, management tips, discussion forums, and e-newsletters.

    ©2004 TechRepublic, Inc.

  • Advertisement

    Talkback 0 comments

    Sponsored content

    Power Centre - Content from our premier sponsors

    Blogs

    • Jacquelyn Holt G'Day USA: Aussie start-ups head to America
      The G'Day USA: Australia Week campaign today announced the finalists for the Innovation Shoot Out event, which will see eight Australian technology start-ups travel to San Francisco in January 2010 to demonstrate the commercial viability of their products in the US.
    • Array All I want for Xmas is Telstra pricing
      Five consecutive days without broadband has led me to what seemed at the time to be an act of desperation: contemplating signing up for Telstra's 100Mbps cable modem service.
    • Array Sick of broken tender sites
      Some of the state governments desperately need to invest in more user-friendly tender sites so that looking for information on government tenders doesn't have to be a game of blind man's bluff.
    • More blogs »

    Tags

    Back to top

    Featured