XL97: How to Link to a Particular Worksheet from a Web Page

Last reviewed: January 7, 1998
Article ID: Q172503
The information in this article applies to:
  • Microsoft Excel 97 for Windows ---------------------------------------------------------------------

SUMMARY

This article explains how to create a link from a Web page to a particular worksheet, range, or defined name in a Microsoft Excel workbook.

MORE INFORMATION

Normally, when you create a link from a Web page to a Microsoft Excel workbook, the path used in the link refers only to the Uniform Resource Locator (URL) for the workbook. For example, if a workbook named "Test.xls" is stored on a Web server named "sample.microsoft.com," use the following syntax to create the link:

   <a href="http://sample.microsoft.com/test.xls">Text for the link.</a>

When you click such a link, the Test.xls workbook is opened in your Web browser, and the worksheet that was active when the workbook was last saved becomes the active worksheet. Because of this design, there is no guarantee that a particular worksheet is displayed when you open the workbook in your Web browser.

However, it is possible to control the worksheet that is displayed when you open a particular workbook in your Web browser. To do this, add the following text to the anchor tag in the Hypertext Markup Language (HTML) code

   #<sheetname>!<rangeordefinedname>

where <sheetname> is the name of the worksheet you want to display (for example, Sheet1) and <rangeordefinedname> is the name of the range (for example, A1 or B5:D10) or defined name (for examplel, MyRange) that you want to select.

For example, if you want to create a link that opens Test.xls when you click it, switches to Sheet3, and selects the range B5:D10, use the following syntax:

   <a href="http://sample.microsoft.com/test.xls#Sheet3!B5:D10">Link
   text.</a>

If you want to link to the MyRange defined name on Sheet2, use the following syntax:

   <a href="http://sample.microsoft.com/test.xls#Sheet2!MyRange">Third
   link.</a>

If you are using a list or some other method of linking to workbooks, the syntax used to create the link may vary, but the syntax used to link to the worksheet, range, or defined name remains the same, for example:

   <option value="http://sample.microsoft.com/test.xls#Sheet3!B5:D10">
Keywords          : xlloadsave xlweb
Version           : WINDOWS:97
Platform          : WINDOWS
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 7, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.