Copyright: Microsoft Knowledge Base
Citation: Copyright (c) Microsoft Corporation. All rights reserved.


Categories and Keywords for All Knowledge Base Articles

Article ID: Q94671

CATEGORIES AND KEYWORDS FOR ALL KNOWLEDGE BASE ARTICLES

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

To categorize articles within the Microsoft Knowledge Base and make finding

information easier, a common set of keywords has been adapted for use

throughout the KB. These keywords are used to categorize the subject of

each article. Each article has one SUBJECT keyword. A secondary keyword

indicating the TYPE of article can also be used.

To query on one category, enter the category code and a wildcard. For

example:

   kb3rdparty*

To query on more than one category, enter each category code with a

wildcard. For example:

   kb3rdparty* or kbinterop* or kbusage*

To query on one subcategory, enter the complete code. For example:

   kbbuglist

To query on more than one subcategory, enter all the complete codes. For

example:

   kbbuglist or kbfixlist

You can also mix categories and subcategories in one query. For example:

   kbtshoot or kbnetwork*

NOTE: At the end of this article is a table that lists formerly used

keywords and their replacements.

INFORMATION CATEGORIES AND KEYWORDS

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

   Article subject                                       Keyword

   ----------------------------------------------------------------

   Interactions with third-party products                kb3rdparty

   Interoperability with other MS products               kbinterop

   How to use product features/functionality             kbusage

   Printing                                              kbprint

   Setup and installation issues                         kbsetup

   Networking                                            kbnetwork

   Environment and configuration information             kbenv

   OLE technology                                        kbole

   Tools, utilities, applets, such as MS Draw or Write   kbtool

   Programming                                           kbprg

   User interface                                        kbui

   Graphics                                              kbgraphic

   Multimedia                                            kbmm

   Hardware                                              kbhw

   Microsoft At Work                                     kbatwork

   Sound (audio) issues                                  kbsound

   Display (video, monitor, resolution) issues           kbdisplay

   Readme files                                          kbreadme

   Lists of vendor phone numbers, disk directory

      listings, other lists or references                kbref

   Support boundaries, policies, processes

      & procedures                                       kbpolicy

   Other: Any subject not covered in other categories    kbother

   Article types                                         Keyword

   ----------------------------------------------------------------

   Application Notes                                     kbappnote

   Bug info for a particular version of a product        kbbuglist

   Sample code                                           kbcode

   Documentation errors                                  kbdocerr

   Error message followup information                    kberrmsg

   FastTip scripts or maps                               kbfasttip

   Binary file information located in the

      Microsoft Software Library                         kbfile

   Fixed bug info for a particular version of

      a product                                          kbfixlist

   Articles listing product-specific keywords            kbkeyword

   Sample macro with article                             kbmacro

   Problems not classified as bugs                       kbprb

   FastTip Technical Library Catalog                     kbtlc

   Troubleshooting information                           kbtshoot

The following table lists formerly used keywords and their replacements.

For explanations of what these keywords represent, see the tables above.

   Old keyword(s)                                        New keyword

   -----------------------------------------------------------------

   3rdparty, isv, 3rd party                              kb3rdparty

   phoneref, diskdir                                     kbref

   errmsg, err msg                                       kberrmsg

   docerr, doc err                                       kbdocerr

   buglist                                               kbbuglist

   fixlist                                               kbfixlist

   softlib                                               kbfile

   tshoot                                                kbtshoot

   appnote                                               kbappnote

   fasttip, ivr                                          kbfasttip

   tlc                                                   kbtlc

MORE INFORMATION

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

Future querying tools may allow for use of friendly names for information

categories. With current searching tools, "printing" cannot be used as a

keyword because that word is also used in many articles whose main subject

is not printing. Until our tools allow searching on keywords separately

from article text, we need to create unique spellings for Knowledge Base

keywords. Therefore, all standard Knowledge Base keywords will begin with

the letters "kb."

Additional reference words: kbkeyword key word kbcdg dskbguide

KBCategory: kbref

KBSubcategory:


 Office, Excel, and Project Article Keywords

Article ID: Q123516

SUMMARY

=======

Keywords are used to categorize all articles within the Microsoft Knowledge

Base and to make information easier to find. Microsoft Office, Microsoft

Excel, and Microsoft Project articles contain some additional product

specific keywords. The following information describes these keywords and

explains how they can be used to search for specific types of articles.

MORE INFORMATION

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

The keywords are grouped below under the following headings:

   KBCategory Keywords (Subject and Type)

   KBSubcategory Keywords (Product Specific)

   Additional Reference Words

   Buglist/Fixlist Keywords in the ABU Databases

KBCategory Keywords (Subject and Type)

--------------------------------------

Every article in the Knowledge Base has at least one SUBJECT keyword, and

may have a secondary keyword indicating the TYPE of article. The Subject

and Type keywords are located in the KBCategory line at the end of an

article.

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q94671

   TITLE     : Categories and Keywords for All Knowledge Base Articles

The following list discusses how these keywords are used in Microsoft

Office, Microsoft Excel, and Microsoft Project articles:

Subject Keywords:

   kbtool     For articles discussing Microsoft Query, add-ins, ToolPak

              functions, spelling checker, function wizard, chart wizard

   kbprg      For articles discussing programming issues (macros or Visual

              Basic procedures)

Type Keywords:

   kbcode     For articles that contain sample Visual Basic code

   kbmacro    For articles that contain Microsoft Excel version 4.0 macro

              code

   kbbuglist  For articles that contain the application's official

   kbfixlist  published bug/fix list or that are listed in the

              application's bug/fix list (see the "Buglist/Fixlist Keywords

              in the ABU Databases" section below)

   Example:

   KBCategory: kbprg kbcode

   KBSubcategory:

KBSubcategory Keywords (Product Specific)

-----------------------------------------

Product specific keywords are located in the KBSubcategory line at the end

of an article. The following is a list of product specific keywords used in

Office, Microsoft Excel, and Project articles:

Office:

   fontasst         Font Assistant

   offasst          Office Assistant

   officeinterop    Interoperability between Office products

   ofcdir           Disk contents/directory for Microsoft Office

Microsoft Excel:

   xlquery          Microsoft Query

   xlwin            Article applies to Microsoft Excel for Windows ONLY

   xlmac            Article applies to Microsoft Excel for the Macintosh

                    ONLY

   xlnt             Article applies to Microsoft Excel for Windows NT ONLY

   xldir            Disk contents/directory for Microsoft Excel

Project:

   Microsoft Project application specific keywords TBD.

Additional Reference Words

--------------------------

Words in the "Additional reference words" line at the end of an article

include the following:

   acronyms (such as gpf, mom, dal, dam, odbc, atp)

   alternate spellings or word choices (such as Novel, toolpack, tool pack,

   hang crash, lock up, freeze, won't respond, interop)

   words that don't appear in the article that you might use to find

   the article (For example, the words XL5 and MXL5 generally appear in the

   title of articles that ONLY apply to version 5.0 of Microsoft Excel for

   Windows or for the Macintosh, respectively. Due to the limited number of

   characters allowed in the title, this keyword may appear in the

   Additional reference words line instead.)

Buglist/Fixlist Keywords in the ABU Databases

---------------------------------------------

Although kbbuglist and kbfixlist are TYPE keywords that apply to all

articles in the Knowledge Base, the following describes how these keywords

are used in Office, Microsoft Excel, and Project articles.

Office:

Currently, these keywords are not used in Office articles, although they

are used in articles for the individual Office applications.

Microsoft Excel:

The kbbuglist and kbfixlist words appear in the following articles:

   1. The article that is a composite of the official published bug list or

      fix list articles.

   2. The individual articles that are listed on the official published

      list.

Project:

TBD

KBCategory: kbkeyword

KBSubcategory:

Additional reference words: 5.00


 Excel: LOOKUP, HLOOKUP, VLOOKUP Return Incorrect Values

Article ID: Q24659

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 1.x, 2.2, 3.0, 4.0,

   5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The Microsoft Excel LOOKUP, HLOOKUP, and VLOOKUP functions will return

incorrect values if the "lookup_vector" argument is not sorted in

ascending order.

MORE INFORMATION

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

"lookup_vector" is the second argument of the LOOKUP function:

  LOOKUP(lookup_value,lookup_vector,result_vector)

"lookup_vector" is the first row of the table_array (second) argument

of the HLOOKUP function:

  HLOOKUP(lookup_value,table_array,row_index_num)

"lookup_vector" is the first column of the table_array (second)

argument of the VLOOKUP function:

  VLOOKUP(lookup_value,table_array,col_index_num)

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, pages 221-222,

264-265, 450-451

"Microsoft Excel Function Reference," version 3.0, pages 123, 145-146,

246-247

"Microsoft Excel Functions and Macros," version 2.2, pages 41-42,

55-56

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.0

2.00 2.01 2.1 2.10 2.2 2.20 3.0 3.00 4.0 4.00 5.00


Excel: Moving Between Unlocked Cells in Protected Worksheet

Article ID: Q25492

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 1.x, 2.2, 3.0, 4.0, 5.0,

   5.0a

----------------------------------------------------------------------

SUMMARY

=======

In a protected Microsoft Excel document, you can select any cell (locked or

unlocked) on the worksheet by using the mouse to click the cell. To cycle

through the unlocked cells in a protected worksheet, press the TAB key.

MORE INFORMATION

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

If the worksheet is protected, you can select the next available unlocked

cell by pressing the TAB key. Microsoft Excel will select the next unlocked

cell that is to the right or below the active cell. If there is no unlocked

cell to the right or below the active cell, then the top-left unlocked cell

in the worksheet is selected.

NOTE: If you are using Microsoft Excel for the Macintosh, you can use

either the TAB key or the ENTER key (on the numeric keypad) to cycle

through unlocked cells.

KBCategory: kbusage

KBSubcategory:

Additional reference words: howto 1.x 2.20 3.00 4.00 5.00 5.00a 5.00c 7.00


Calculate Precision As Displayed Versus Format Number

Article ID: Q25653

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, numbers are rounded based on their stored values rather

than on their displayed values.

When you format numbers by choosing the Cells command from the Format menu

(the Numbers command in versions earlier than 5.0), you alter the way the

numbers are displayed; however, when you calculate numbers, the

calculations are performed with the stored versions of these numbers. When

you calculate formatted values, you may receive unexpected results because

the displayed versions of the numbers may be slightly different than their

stored values.

WORKAROUND

==========

To calculate numbers based on their displayed values, select the Precision

As Displayed option. This option truncates numbers in cells so that the

stored number is the same as the displayed number.

To select the Precision As Displayed option, follow the appropriate

procedure below.

Microsoft Excel versions 5.0 and later

--------------------------------------

1. From the Tools menu, choose Options.

2. Select the Calculation tab.

3. On the Calculation tab, under Workbook Options, select the Precision As

   Displayed check box.

Microsoft Excel versions 4.x and earlier

----------------------------------------

1. From the Options menu, choose Calculation.

2. In the Calculation dialog box, select the Precision As Displayed check

   box.

MORE INFORMATION

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

The Precision As Displayed command typically is used to prevent rounding

errors when working with currency.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 5.00


Printing without Headers or Footers Using PAGE.SETUP in Excel

Article ID: Q25764

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0,

   5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

In Microsoft Excel, use the following macro command to remove the header

and footer from the active sheet:

   =PAGE.SETUP("","",0.75,0.75,1,1,TRUE,TRUE)

The double quotation marks for the header and footer indicate that an empty

string is to be used for the header and footer.

In Microsoft Excel versions 5.0 and later, you can use the following codein

a Visual Basic module to remove the header and footer from the active

sheet:

   With ActiveSheet.PageSetup

      ' Set the value of each header and footer to empty

      .LeftHeader = ""

      .CenterHeader = ""

      .RightHeader = ""

      .LeftFooter = ""

      .CenterFooter = ""

      .RightFooter = ""

   End With

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.0 2.01 2.1 2.10 2.2 2.21 2.20 3.00

3.0 4.00 4.0 5.00 5.0


Excel: How to Keep Certain Values from Being Displayed

Article ID: Q25903

-----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, and 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 2.2, 3.0, 4.0, 5.0, 5.0a

-----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel for the Macintosh, if you do not want certain values to

be displayed or printed, do the following:

1. Select the cells that contain the values.

2. On the Format menu, click Cells (click Number if you are using Microsoft

   Excel 4.0a or earlier).

3. Click the Number tab, select Custom, type two quotation marks ("") and

   click OK. (Type the quotation marks in the Code box if you are using

   Microsoft Excel 4.0a or earlier.)

MORE INFORMATION

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

The following table shows the custom formats you can use to keep certain

values from being displayed.

   To hide this                   Use this format

   ------------------------------------------------------------

   Positive numbers               ;-General;General;General

   Negative numbers               General;;General;General

   Zero values                    General;-General;;General

   Text values                    General;-General;General;

   All values                     ;;;

   Error values                   See "Example 3" later in this

                                  article.

NOTE: Variations of these formats may also be used instead of General.

Example 1

---------

To hide numbers only, do the following:

1. In a new worksheet, enter the following sample data:

      A1:  Monday         B1:   1500

      A2:  Tuesday        B2:   2500

      A3:  Wednesday      B3:   3500

      A4:  Thursday       B4:   4500

      A5:  Friday         B5:   5500

2. Select the range A1:B5.

3. On the Format menu, click Cells (click Number if you are using Microsoft

   Excel 4.0a or earlier).

4. Select Custom and type "" in the Type box. (Type "" in the Code box if

   you are using Microsoft Excel 4.0a or earlier.)

Note that the values in the range B1:B5 are no longer visible on your

worksheet. However, if you select any cell in the range B1:B5, its value

will be displayed in the formula bar.

Example 2

---------

To hide ALL cell entries, do the following:

1. Select the cells.

2. On the Format menu, click Cells, and click the Number tab. (Click Number

   if you are using Microsoft Excel 4.0a or earlier.)

3. Select Custom under Category, and enter ";;;" (without the quotation

   marks) under Type, and click OK.

NOTE: This method will not hide error values. To hide an error value, see

Example 3.

Example 3

---------

To hide an error value, use the ISERROR() function to trap the error value,

and display a text value instead, as in the following example:

   A1: 5

   A2: 0

   A3: =IF(ISERROR(A1/A2),"error",A1/A2)

When you use the ";;;" number format in cell A3, the result of the IF()

function (the text string "error") will be hidden in cell A3.

For an example of how to do this with a macro, please see the following

article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q138080

   TITLE     : XL: Macro to Suppress an Error Value Returned by a Formula

KBCategory: kbusage

KBSubcategory:

Additional words: howto 1.03 1.04 1.06 1.50 2.20 3.00 4.00 5.00 5.00c 5.00a

7.00


Excel: Can't Change Left/Right Margins for Headers and Footers

Article ID: Q26626

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 1.x, 2.x, 3.0, 4.0,

   5.0, 5.0a

----------------------------------------------------------------------

In Microsoft Excel, headers and footers always have left and right margins

of 0.75 inch. Therefore, left-aligned text in the header or footer will

always begin 0.75 inch from the left edge, regardless of the left margin.

Similarly, right-aligned text will always print to 0.75 on the right side.

When you use the Legal size paper option, Microsoft Excel positions left-

aligned text in the header or footer approximately 1 inch from the left

side. This change in margin size is to allow for the limitations of the

LaserWriter when you print to legal size paper.

KBCategory: kbprint

KBSubcategory:

Additional words: 2.2 2.20 3.0 3.00 4.0 4.00 5.00 5.00a 5.00c


Auto_Open Macro Not Working Correctly on Excel Worksheet

Article ID: Q28189

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

To create a macro that runs automatically every time you open a particular

Excel document, do the following:

Microsoft Excel version 5.0 and later

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

1. Open the workbook from which you want to run your macro. Select either a

   worksheet or macro sheet tab.

2. On the sheet, define the name Auto_Open that refers to the macro that

   you want to run, as in the following examples:

      =My_Macro (My_Macro located in same workbook)

      -or-

      =BOOK2.XLS!My_Macro (My_Macro located in separate workbook)

   Note that My_Macro may be either a Visual Basic macro or a Microsoft

   Excel 4.0 macro.

3. Close and save the workbook.

Microsoft Excel versions 2.x, 3.0, 4.0

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

1. Open both your worksheet and your macro sheet.

2. On your worksheet, define your Auto_Open macro with a reference to the

   open macro sheet, as in the following example:

      =test.xlm!my_macro

3. Close the macro sheet.

4. Save the worksheet.

The Auto_Open macro now runs correctly when you open the worksheet.

MORE INFORMATION

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

In Excel 2.x for Windows, symptoms of an improperly defined Auto_open

macro are:

 - dropping to MS-DOS

 - the error message "Cannot find Auto_open"

 - system lockups upon loading the document

REFERENCES

==========

"Microsoft Excel User's Guide," version 3.0, pages 622-624

"Microsoft Excel Functions and Macros," version 2.x, page 194

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.0 2.01 2.1 2.10 2.2 2.21 2.20 3.00

3.0 4.00 4.0 5.00 5.0 auto open


Avoiding Circular-Reference Errors When Keeping Running Totals

Article ID: Q28872

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 2.2, 3.x, 4.x, 5.0,

   5.0a

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can use one cell to keep a running total of

the numbers that you enter in a second single cell. For example, you

have cell B1 total the numbers that are entered in cell A1 by using

the formula =A1+B1. To do this without generating a circular-reference

error, follow the steps below.

MORE INFORMATION

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

You can keep a running total by doing the following:

1. From the Tools menu, choose Options, and then choose Calculation. (If

   you are using a version of Microsoft Excel earlier than 5.0, choose

   Calculation from the Options menu.)

2. Set the Calculation field to Manual.

3. Select in the Iteration check box.

4. In the Maximum Iterations box, type "1" (without the quotation marks).

These steps limit the number of calculations to one, eliminating the

circular-reference error. However, calculations must now be performed

manually by selecting Calculate Now from the Options menu. Note that these

changes are global.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 5.00


Options Protect Document and Password Features in Excel

Article ID: Q29027

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.0, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

The main difference between Options Protect Document and the Password

feature under the File Save As Options command is as follows:

1. The Options Protect Document command allows the file to be opened

   and viewed, but not edited. However, if there are external

   references in the worksheet, the cells will update appropriately.

2. The Password feature prevents the opening of a document without the

   proper password. When the document is requested, Microsoft Excel will

   prompt for the password. When the document is open, Microsoft Excel

   allows editing of that document.

Neither feature allows access or editing without the proper password. If

you don't use the password, you cannot access or edit the documents.

For more information about protecting your document in Microsoft Excel

version 5.0, choose the Search button in Help and type:

   protect sheet

   -or-

   protect workbook

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.20 2.21 3.0 3.00

4.0 4.00 5.0 5.00


Excel Err Msg: "File Format Is Not Valid" with Linked Document

Article ID: Q30583

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for the Macintosh, versions 2.2, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you attempt to update links to a closed file that is

saved in a file format other than Microsoft Excel (for example if you save

it in the text file format), you may receive the following error message:

   External Copy: file format is not valid

CAUSE

=====

For a list of the file types that you cannot update links to if the linked-

to file is closed, see the following table. In the table, "x" means that

the file format causes the error message and "No error" means that the file

format does not cause the error message.

   Formats that

   may return an    MS Excel 3.0

   error message    or earlier         MS Excel 4.0   MS Excel 5.0

   -----------------------------------------------------------------

   Text              x                  x                 x

   CSV               x                  x                 x

   SYLK              x                  x                 x

   WKS               x                  x                 No error

   WK1               x                  x                 No error

   WK3               x                  x                 No error

   DIF               x                  x                 x

   DBF2              x                  x                 x

   DBF3              x                  x                 x

   DBF4              x                  x                 x

   MS Excel 2.1      x                  No error          No error

   MS Excel 3.0      No error           No error          No error

   MS Excel 4.0      N/A                No error          No error

WORKAROUNDS

===========

To avoid receiving this error message, use any of the following methods.

Method 1: Open the external file before you attempt to update links to it.

Method 2: Save the file in a file format that allows you to update links

          when the linked-to worksheet is closed.

MORE INFORMATION

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

Microsoft Excel 5.0 and later:

For more information about File Formats (Windows) or File Formats

(Macintosh), choose the Search button in Help, and type the following:

   file formats, defined

For an Overview of Linking and Embedding, choose the Search button in Help

and type the following:

   Links command (Edit menu), purpose

Microsoft Excel 4.0:

"User's Guide," version 4.0, pages 127-136

Microsoft Excel 3.0:

"User's Guide," version 3.0 for Windows, pages 316-325

"User's Guide," version 3.0 for the Macintosh, 308-317

KBCategory: kbole kbusage

KBSubcategory:

Additional reference words: 7.00 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.2 2.20

3.0 3.00 4.0 4.00 5.00 5.00c OLE


Calculating the Future Value of a Single Cash Flow in Excel

Article ID: Q30970

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh versions 2.x, 3.0, 4.0

----------------------------------------------------------------------

The FV function in Microsoft Excel returns the future value of an

investment based on periodic, constant payments and a constant interest

rate.

The FV function can also be used to calculate the future value of a single

lump sum payment. To do this, enter the lump sum payment amount as the

present value (PV) and enter the payment amount as zero. Entering a zero as

the payment amount tells Excel there is no constant stream of payments.

For example, suppose that you will invest $1,000 today at an interest rate

of 12 percent, and you would like to know what the investment will be worth

at the end of five years.

The FV formula is entered as follows:

   =FV(12%,5,0,-1000,0)

REFERENCES

==========

"Microsoft Excel Functions and Macros," versions 2.x, page 53

"Microsoft Excel Function Reference," version 3.0, page 98

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21

3.0 3.00 4.0 4.00


Excel: "Database Range Not Defined"/Data Missing Saving to dBASE

Article ID: Q31817

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if a database is not defined on the worksheet, you may

receive the following error message when you save a worksheet to the dBASE

(.DBF) file format:

   Database range is not defined

Also note that only the data that is in the database range will be saved to

the .DBF file. (Other data on the worksheet will be lost when you save to

this file format.)

CAUSE

=====

In Microsoft Excel versions 4.0 and earlier, you must define a database on

the worksheet before you save it to the dBASE file format.

WORKAROUND

==========

To define a database on a worksheet so that you can save it in a dBASE file

format, do the following:

1. On the Microsoft Excel worksheet, select the range that contains the

   database.

2. From the Data menu, choose Set Database.

3. Save the file to the desired dBASE file format.

NOTE: When you add records to an old .DBF file, you must remember to extend

the database range so that the new data can be saved.

MORE INFORMATION

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

In Microsoft Excel for Windows version 2.x, you can save a file to the

dBASE II and dBASE III file format. In Microsoft Excel for Windows versions

3.0 and later, you have the added capability of saving a file to the

dBASE IV file format.

For more information about how files are saved to dBASE file format in

Microsoft Excel versions 5.0 and later, please query on the following

article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID:Q46228

   TITLE     :Data Lost When File Saved in .DBF File Format

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 5.00

err msg

dbf


Curve Fitting with Excel Using the TREND Function

Article ID: Q34315

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

----------------------------------------------------------------------

SUMMARY

=======

The following information describes how to perform polynomial curve

fitting with the TREND function.

An Explanation of Curve Fitting

-------------------------------

Curve fitting is useful for making projections beyond a data range

(extrapolation) or for making estimates between acquired data points

(interpolation). For example, suppose a scientist has collected data,

such as voltage versus resulting current, as follows:

   Voltage   Resulting Current

   ----------------------------

         1       1.5

         2       3.7

         3       5.0

         4      13

         5      16

         6      30

         7      35

         8      50

This data is nonlinear; therefore, the corresponding graph is not a

straight line (the actual formula used here was  y=x^2-2*x+3 with the

values adjusted at random to represent real laboratory data). An

approximating formula for a curve that would best fit the known data

points is necessary.

Using the TREND Function for Curve Fitting

------------------------------------------

The following steps use the TREND function to fit a curve to the data

points from the above sample data.

1. Enter the following data on a worksheet with the name "Sheet1":

   a. Enter the x-data (1, 2, 3,...8) in cells D1 through D8. Also,

      enter 9 in cell D9.

   b. Enter the corresponding measured y-data (1.5, 3.7, 5, 13, 16,

      30, 35, and 50) in cells E1 through E8.

   c. Enter the increasing powers of x to regress against your

      y-values to achieve a polynomial fit. In cell C1, enter the

      formula "=D1^2" (without quotation marks) and select the range

      C1 through C9. From the Edit menu, choose Fill Down.

   d. Repeat step c in column B with the formula "=D1^3" (without

      quotation marks), and in column A with the formula "=D1^4"

      (without the quotation marks).

   e. Enter the TREND function as an array formula in cells F1 through

      F8. Select this range and enter the following formula in cell

      F1 (do not press ENTER yet):

         =TREND(E1:E8,A1:D8)

2. Press CTRL+SHIFT+ENTER to enter this formula as an array formula.

   The curve-fitted values will now appear in cells F1 through F8.

   These values can be plotted along with the known y-values versus

   the known x-values to achieve a graphical representation of the

   quality of the initial y-measurements.

3. To extrapolate a value at x=9, position the cursor in cell F9 of

   Sheet1. Type the formula

      =TREND(E1:E8,A1:D8,A9:D9)

   and press the ENTER key. Note that when you specify the range of

   new x-values, the equivalent higher powers of these x-values must

   also be calculated and specified in the new x range (that is, the

   new x-values must have the same format as the known x-values).

NOTE: The goal in curve fitting is to find a polynomial that

approximates the function (or set of known x-values and y-values) in

question. For instance, suppose we start with the function y=sin(x).

Most computer languages have the SINE function built in, but the

computer must go through extensive calculations to arrive at an

answer. If this function were nested in a loop, it could slow the

operation of the computer considerably.

MORE INFORMATION

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

Using a Simpler Formula in Place of SINE

----------------------------------------

A quicker approach, if absolute accuracy is not necessary, is to

substitute a different formula in place of the SINE function that

approximates the original function in a predefined interval on the

x-axis. This formula is  simpler and therefore faster for the computer

to calculate.

Assume you are interested in the interval from x=0 to x=1. An

approximating polynomial for y=sin(x) of degree 0 might be y=1, of

degree 1 might be y=x, and of degree 3 might be y=x+(x^3)/6. The

degree of the polynomial refers to the highest power of x used.

If you understand Taylor polynomials, you know why you skipped the

polynomial of Degree 2, and how you arrived at the other polynomials.

If you are not familiar with Taylor polynomials, do not worry about it

because Microsoft Excel will handle the details. The following is an

example:

                       DEGREE

                0        1        3

   x-value   y=sin(x) | y=1    y=x      y=x-(x^3)/6

   -------------------------------------------------

    0.000     0.000    1.000    0.000    0.000

    0.200     0.199    1.000    0.200    0.199

    0.400     0.389    1.000    0.400    0.389

    0.600     0.565    1.000    0.600    0.564

    0.800     0.717    1.000    0.800    0.715

    1.000     0.841    1.000    1.000    0.833

The higher the degree of the approximating polynomial, the higher the

accuracy. Higher degree polynomials require more calculations, so

there is a point of diminishing returns. Also, high

degree-approximating polynomials may produce inaccurate, highly

fluctuating results (a good rule to follow is to use polynomials of

degree no higher than 5).

Microsoft Excel version 5.0

---------------------------

Microsoft Excel version 5.0 has the built-in capability to insert a

polynomial curve into your existing x-y scatter chart. To insert this type

of curve, follow these steps:

1. On the chart, select the series for which you want the polynomial curve.

2. From the Insert menu choose Trendline.

3. From the Type tab, choose Polynomial with Order 2.

The polynomial curve is now added to your chart.

For information about another curve fitting technique, query on the

following word in the Microsoft Knowledge Base:

   newton

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00


Curve Fitting with Excel Using the Newton Method

Article ID: Q34318

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0. 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

The following instructions describe how to perform polynomial curve fitting

with Microsoft Excel. This technique will utilize a user-defined function

(NEWTON) based on the algorithm of Newton's Divided Differences. For more

information on curve fitting with Microsoft Excel, query on the words:

   trend and fit and excel

The TREND function can be used when there is a wide range of x-values, and

the NEWTON function is much more accurate on the range -4 to +4. The TREND

instructions end with a brief outline of the math involved. An example of

curve fitting is where a scientist has data, such as current versus

voltage, and needs to make projections beyond the data range (extrapolation

at voltage 9, using TREND) or make estimates between the acquired data

points (that is, interpolation at voltage 3.5, using NEWTON).

Assume the following data:

   At Voltage (x's)   The Resulting Current (y's)

   ----------------   ---------------------------

           1                    1.5

           2                    3.7

           3                    5.0

           4                   13

           5                   16

           6                   30

           7                   35

           8                   50

This data is definitely nonlinear (that is, the corresponding graph is not

a straight line). The actual formula used here was y=x^2-2*x+3 with the

values adjusted at random to represent real laboratory data. An

approximating formula for a curve that would best fit the known data points

is necessary.

MORE INFORMATION

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

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided 'as is' and Microsoft does not guarantee that the

following code can be used in all situations. Microsoft does not support

modifications of the code to suit customer requirements.

You can create your own function for polynomial curve fitting and

interpolation. It is assumed here that the following code has been entered

on a macro sheet named "Macro1". Before starting, you should know the

following Microsoft Excel macro functions (page numbers refer to the

"Microsoft Excel Macros and Functions" manual for versions 2.x):

   1. =RESULT(type) (page 343)

   2. =ARGUMENT(type) (page 251)

   3. =INDEX(array, position) (page 60)

   4. =SET.NAME(variable, value) (page 354)

   5. =SET.VALUE(ref,value) (page 356)

   6. =FOR()..=NEXT() (page 280)

   7. =RETURN(value) (page 343)

   Starting in cell A1 of the macro sheet, enter the code as follows:

   A1:  newton

   A2:  =RESULT(64)

   A3:  =ARGUMENT("xo",64)

   A4:  =ARGUMENT("fx",64)

   A5:  =ARGUMENT("newx",64)

   A6:  v=INDEX(xo,1)

   A7:  w=INDEX(xo,2)

   A8:  x=INDEX(xo,3)

   A9:  y=INDEX(xo,4)

   A10: =SET.NAME("Result",Result.area)

   A11: =SET.NAME("size",ROWS(xo))

   A12: =FOR("k",1,size,1)

   A13: =SET.VALUE(INDEX(Result,k,1),INDEX(fx,k))

   A14: =NEXT()

   A15: =FOR("i",2,size,1)

   A16: =FOR("j",2,i,1)

   A17: =SET.VALUE(INDEX(Result,i,j),((INDEX(Result,i,j-1)-

        INDEX(Result,i-1,j-1)))/(INDEX(xo,i)-INDEX(xo,i-j+1)))

   A18: =NEXT()

   A19: =NEXT()

   A20: =RETURN(C1+D2*(newx-v)+E3*(newx-v)*(newx-w)+F4*(newx-

        v)*(newx-w)*(newx-x)+G5*(newx-v)*(newx-w)*(newx-x)*(newx-

        y))

The argument "xo" refers to the known x's, the argument "fx" refers to the

known y's, and the argument "newx" refers to the new value of x in

question. The value returned is a function of a fourth degree approximating

polynomial.

You must now define a range to hold the results of the various calculations

made during the operation of this macro. Highlight the range C1 through V30

and name this range "Result.area" by choosing Define Name from the Formula

menu. This range is large enough to handle up to 20 data points (known

x's). Name this as a function macro by choosing Define Name from the

Formula menu and checking it as a function.

It is assumed that the known x data listed above has been placed in cells

D1 through D8, and the known y data has been placed in cells E1 through E8

on a worksheet named "Sheet1". To use this function, do the following:

1. Select cell G1 on Sheet1. From the Formula menu, choose Paste

   Function and select Paste Arguments. Find the NEWTON function at

   the bottom of the function list, highlight it, and press ENTER.

2. For the arguments, type the following and press ENTER:

      $D$1:$D$8,$E$1:$E$8,D1

3. Highlight the range G1 through G9 and choose Fill Down from the

   Edit menu. The curve-fitted values will now appear in cells G1

   through G9.

For an example of interpolation, choose cell H1 and enter the NEWTON

function using Paste Function from the Formula menu. For the arguments,

type the following and press ENTER:

   $D$1:$D$8,$E$1:$E$8,3.5

Please note that for interpolation, the NEWTON function is usually more

accurate than the TREND function on short intervals close to zero.

NOTE: in Microsoft Excel version 5.0, it is not necessary to create your

own function for polynomial curve fitting and interpolation. The

functionality is built-in. For additional information, choose Search for

Help on.... from the Help menu, type the word "trendlines" (without the

quotation marks), choose Show Topics; select a topic and choose Go To.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00


Excel: Keeping a Cumulative Total in a Column or Row

Article ID: Q36950

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for the Macintosh, versions 1.x, 2.2, 3.x, 4.x, 5.0

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, to calculate a cumulative total in a column or row

of cells, use a combination of absolute and relative references in a

SUM() formula.

For example, to keep a running total of cells A1 through A10 in

column B (for example, B1 contains the value from A1, B2 contains

A1+A2, B3 contains A1+A2+A3, etc.), set up the worksheet as follows:

1. Enter the formula, =SUM($A$1:A1), into cell B1.

2. Select cells B1 through B10.

3. From the Edit menu, choose Fill Down.

The $A$1 (absolute reference) will be constant in each cell, while the

A1 (relative reference) will be updated in each successive cell to

refer to the adjacent cell in column A.

NOTE: This information alos applies to the AVERAGE() formula.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.2 2.20

3.0 3.00 4.0 4.00 5.00


Two-Step Method to Calculate Bond Price in Excel

Article ID: Q37993

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

It is possible to calculate the price of a bond in just two steps,

while still using the "long" method of calculation. This method of

price calculation is preferred to the shorter method of present value

tables, due to the greater accuracy of the long method. The accuracy

becomes increasingly important as the face value of the bond grows and

time to maturity increases.

To do this calculation, do the following:

1. From the Data menu, choose Series and enter the number of periods until

   maturity is in sequential order (that is, A1 is 1, A2 is 2, and so

   on).

   Microsoft Excel 5.0 and later

   -----------------------------

   From the Edit menu, choose Fill then Series, and enter the number of

   periods until maturity is in sequential order (that is, A1 is 1, A2 is

   2, and so on).

2. In another cell (that is, cell C1), enter the following array

   formula:

      {=SUM(I/(1+Y)^A1:A2)}

   Please note that the curly braces are not typed, they are the

   result of entering the formula with CTRL+SHIFT+ENTER. This makes it

   an array formula. I = interest payments, Y = yield to maturity

   (required rate of return), n = total number of periods.

3. In still another cell (that is, cell C2), enter the following

      =C1+(Pn/(1+Y)^n)

   where Pn= Principle payment at maturity.

This cell will return the present value (the most you should be

willing to pay for the bond based on your required investment return

"Y") of a bond that matures at time n.

KBCategory: kbusage

KBSubcategory:

Additional words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 7.00


Excel: Errors Sorting Cells That Contain References

Article ID: Q40401

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you sort a column of values that are the result of

arithmetic operations based on relative references, you may receive #REF

error values.

CAUSE

=====

To correctly sort a range that includes cells with references, all

references must be absolute references. Using relative references can

result in errors because the references may become invalid when the cells

are rearranged in the specified sort order.

For example, given these cell and sorting A1:C3 in ascending order

with the sort key being cell A1

   A1: 3  B1: =A3     C1: =$A$3

   A2: 2  B2: =A2     C2: =$A$2

   A3: 1  B3: =A1     C3: =$A$1

the resulting formulas will be:

   A1: 1  B1: =#REF!  C1: =$A$1

   A2: 2  B2: =A2     C2: =$A$2

   A3: 3  B3: =A5     C3: =$A$3

Note that cell B1 is now an invalid reference and that cell B3

has lost its reference to A3 and now refers to A5. The formulas

in column C have been correctly sorted.

KBCategory: kbother

KBSubcategory:

Additional reference words: 7.00 5.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21

3.0 3.00 4.0 4.00 data


Converting a Number with Minus Sign on Right to Minus on Left

Article ID: Q42964

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

When you import a worksheet into Microsoft Excel and that worksheet

contains numbers with minus signs on the right (for example, 12345-),

Microsoft Excel may not treat these numbers as negative numbers.

CAUSE

=====

Microsoft Excel treats these numbers as text because the minus sign appears

to the right side of the number.

WORKAROUND

==========

If you want these numbers to be interpreted as negative numbers, you need

to create a macro that will move the minus sign from the right side of the

number to the left. Use the appropriate macro below for your version of

Microsoft Excel.

NOTE: You must select the range of cells containing the values you want to

change before you run the macro.

Microsoft Excel versions 5.0 and later

--------------------------------------

Sub move_minus_left()

   Dim currentcell As Object

   For Each currentcell In Selection

      If Right(currentcell.Value, 1) = "-" Then

         currentcell.Formula = "-" & Left(currentcell.Value, _

            Len(currentcell.Value) - 1)

      End If

   Next currentcell

End Sub

Microsoft Excel versions 3.0, 4.0, and 4.0a

-------------------------------------------

A1: =FOR.CELL("Current")

A2: =SELECT(Current)

A3: =IF(RIGHT(Current,1)="-",FORMULA("-"&LEFT(Current,LEN(Current)-1)),)

A4: =NEXT()

A5: =RETURN()

Microsoft Excel versions 2.x

----------------------------

A1: Switch Minus Sign

A2: =ACTIVE.CELL()

A3: =IF(RIGHT(A2,1)="-",FORMULA("-"&LEFT(A2,LEN(A2)-1)),)

A4: =RETURN()

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00 import mainframe miniframe main mini

frame export


Excel: General Number Format Rounds Off Real Numbers

Article ID: Q45646

-------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

-------------------------------------------------------------------

SUMMARY

=======

The General number format rounds off numbers for display if the column

width is not sufficient for the display of all the decimal digits.

Generally, if the column width selected is less than the width needed

to display the entire number, it is rounded off to the nearest decimal

place or whole number that the column width will allow. For example:

   2.86 may be rounded to 2.9 or 3

   2.3  may be rounded to 2

   0.3  may be rounded to 0

This effect is quite the opposite of that of the other number formats,

which display number signs (#) across the width of the column if the

width is not sufficient to display all the decimal digits. However the

number will be displayed as (#) if the column width becomes too small

to display the entire number.

However, all calculations based on these values use the original

stored values, and this is true even if the Precision As Displayed box

is checked in the Calculation dialog box on the Options menu.

Using the following example:

  A1: 2  B1:19.15  C1:  2.3   D1: 19.15

  A2: 3            C2:  2.5

  A3: 3            C3:  2.5

  A4: 3            C4:  3.2

  A5: 3            C5:  2.7

  A6: 1            C6:    1

  A7: 2            C7  2.45

  A8: 3            C8:  2.5

A1:A8 is an exact copy of C1:C8, and both B1 and D1 sum these ranges,

respectively. Column A is formatted for a width of 2.86, while the

others are at the standard 8.43 default. All cells are at the default

General number format.

If A1 (or other cells in that column) is active, the formula bar still

shows the original value, that is, 2.3.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 2.00 2.0 2.1 2.10 3.0 3.00 4.0 4.00

real rounding


XL5: Data Lost When File Saved in .DBF File Format

Article ID: Q46228

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

When you save a Microsoft Excel file to the dBASE (.DBF) file format, only

the list containing the currently selected cell or the area that has a

defined name "database" is saved to the new file. Any data that does not

fall within that range is lost.

Note also that only the selected worksheet in the workbook is saved to the

dBASE file format.

MORE INFORMATION

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

When you save a file to the dBASE file format in Microsoft Excel version

5.0, only the currently selected list, the list containing the currently

selected cell, or the range with the defined name "database" is saved. A

range on the worksheet that has the defined name "database" will take

precedence over the selected list (that is, the .DBF file will contain the

data from the "database" rather than the data from the selected list). If

no list is found on the worksheet, you receive the following error message:

   No list found. Select a single cell within your list and Microsoft Excel

   will select the list for you.

When you save your file to the dBASE file format, options set in the Page

Setup dialog box are lost. For example, if you go to the Page tab in the

Page Setup dialog box and set the scale to 75%, the scale will revert to

100% if you close the file (saving any changes) and reopen it in Microsoft

Excel.

Additional reference words: 5.00 5.00c 7.00 change update


Auto_Close, Auto_Open Macros Not Executed in Excel

Article ID: Q46350

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

An Auto_Open macro is a macro that is defined to automatically run

when the sheet is opened.

An Auto_Close macro is a macro that is defined to automatically run

when the sheet is closed.

These procedures work correctly when you open or close the sheet

manually. However, if the sheet is opened or closed by another macro,

the automatic macros will not be executed. This behavior is by design.

This is also true for Solver, Q+E, and all add-in macros included in

the Microsoft Excel LIBRARY subdirectory. Because the Auto_Open macro

does not run when you open these files from another macro sheet, you

will be unable to execute any of the menu commands that these add-in

macros supply.

Workaround

----------

You can cause the Auto_Open macro to run by simply placing a RUN

statement in the calling macro that then runs the Auto_Open macro. An

example using the add-in FLATFILE.XLA macro is shown below:

   A2:=OPEN("Flatfile.xla")

   A3:=RUN(Flatfile.xla!Auto_Open)

After executing the RUN statement, you are then able to run any menu

commands that FLATFILE.XLA normally supplies.

REFERENCES

==========

"Microsoft Excel User's Guide," version 3.0, page 676

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.10c 2.10d 3.00 3.0 2.1d

2.1c 2.1 2.0


Exporting HPGL Format from Microsoft Excel

Article ID: Q47142

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

To export Microsoft Excel graphics in the HPGL (Hewlett-Packard Graphics

Language) format, print the graphic to a file using the HP Plotter driver.

The file can be read directly by another application such as Ventura

Publisher, WordPerfect, Word, PageMaker, and so on.

MORE INFORMATION

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

To export a Microsoft Excel graphic in the HPGL format, you must first have

a driver installed that supports an HP plotter and configure it to print

directly to a file instead of your normal printer port. To accomplish this,

use the appropriate procedure below.

If You Are Running Microsoft Excel Under Windows 95

---------------------------------------------------

1. Click the Start button, and then click Settings.

2. Click the Control Panel icon.

3. In the Control Panel window, click Printers.

4. Click the Add Printer icon, and follow the steps in the Add Printer

   Wizard to install and configure the HP ColorPro plotter driver to print

   to a file.

If You Are Running Microsoft Excel Under Windows 3.0 or 3.1

-----------------------------------------------------------

1. Start Windows Control Panel.

2. Double-click the Printers icon.

3. Select Add Printer, choose the HP ColorPro plotter from the list

   of printers, and select Install.

4. Select Configure. From the list of ports, choose FILE: and

   choose OK.

4. Select Active and choose OK.

5. Close the Control Panel Window.

If You Are Running Microsoft Excel Under

an Earlier or Run-Time Version of Windows

-----------------------------------------

1. Open the WIN.INI file (located in the \WINDOWS directory) into a

   text editor such as Notepad.

2. Find the section labeled "[Ports]" in this file. Add a line under

   this section that reads

      OUTPUT.HGL=

3. Save this file, exit, and restart Windows.

4. Run the Windows Control Panel. From the Installation menu, Add New

   Printer, and install for an HP plotter.

5. From the Setup menu, choose Connections. In the list of printers,

   select the plotter. In the list of ports, select OUTPUT.HGL.

6. Exit Control Panel.

Now when you want to create an HPGL file in Microsoft Excel, choose Printer

Setup from the File menu, choose the HP Plotter and select OK. If you

choose Print from the File menu, Excel will first respond with the normal

printing dialog boxes, followed by a prompt for a filename if running under

Windows 3.0 or 3.1. Respond with a filename that has an .HGL extension. If

you are not running under Windows 3.0 or 3.1, Microsoft Excel will print to

the file called OUTPUT.HGL that you added to your WIN.INI file.

Note: Because Windows versions prior to 3.0 will always plot to the same

file, OUTPUT.HGL in this case, be sure to copy this file under another name

before plotting to it again or you will lose your previous data.

These .HGL files can then be imported into Word for Windows using the

Insert Picture command, or into PowerPoint using the File Paste From

command. These graphics can then be scaled and cropped normally in both

applications.

When preparing to create HPGL files for importing into other applications,

keep the following items in mind:

1. The output from Excel depends heavily on which plotter you have

   configured for under Printer Setup. You may want to experiment with

   selecting different plotters to see how it affects your imported

   graphics.

2. Related to the type of plotter selected is the type of fonts you

   are using. For consistent results, format text using a printer font.

REFERENCES

==========

"Microsoft Windows User's Guide," version 3.0, pages 210-211

"Microsoft Windows User's Guide," version 2.0, page 213

KBCategory: kbusage kbprint kbgraphic

KBSubcategory:

Additional Words: 2.0 2.00 2.01 2.1 2.10 3.0 3.00 4.0 4.00 5.0 5.00 7.00


Excel: Importing and Exporting R:BASE Databases

Article ID: Q47664

-------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0

   5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

-------------------------------------------------------------------

Microsoft Excel does not directly support the import or export of R:BASE

databases. However, R:BASE System V, R:BASE for DOS, and R:BASE for

OS/2 can import and export in Lotus, dBASE, ASCII delimited, SYLK, and

DIF file formats through its Filegateway module. Excel can read and

write all of those file formats.

KBCategory: kb3rdparty

KBSubcategory:

Additional reference words: 7.00 5.00 3.00 3.0 4.00 4.0 rbase


Data Sort Not Sorting Correctly in Excel

Article ID: Q48254

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

----------------------------------------------------------------------

SUMMARY

=======

After you perform a data sort on a range, the range seems to have sorted

and returned to its original unsorted order. (NOTE: in version 5.0,

Microsoft Excel prompts you if you select a range contained within a

contigious range of data.)

MORE INFORMATION

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

This problem occurs if the data you are sorting is composed of the results

of formulas. The results may be sorted and appear sorted for a moment, but

the formulas recalculate and the original results return to the cells.

To avoid this problem, make sure that the source cells for the calculations

in the formulas are sorted as well.

Example

-------

   What You See                   What Is Really There

   ------------                   --------------------

   A1: 1  B1: 2                   A1: 1  B1: =A1+1

   A2: 0  B2: 1                   A2: 0  B2: =A2+1

If you select B1:B2 and sort in ascending order, you will see the results

of the formulas appear quickly in ascending order, then the formulas will

recalculate the original contents of the affected cells. This assumes that

the entries in column A are not included in the sort.

A second workaround for this problem is to select the cells with the

formulas and then perform Edit Copy, Edit Paste Special Values. This method

works only if it is acceptable to replace the formulas with the resulting

values permanently.

A third workaround is to use absolute reference (example =$A$1). The

following macro converts a range of cells to absolute references:

   A1: =FOR.CELL("curcell",,TRUE)

   A2: =FORMULA(FORMULA.CONVERT(GET.CELL

        (6,curcell),TRUE,FALSE,1,curcell),curcell)

   A3: =NEXT()

   A4: =RETURN()

A fourth workaround is to use the sheet name in the reference. When the

sheet name is included it remains the same as an absolute reference.

However, you can use relative references (example =sheet1!a1+1) so that the

formula can be easily copied through the range.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 4.00a


Math Coprocessor May Use Different Level of Precision

Article ID: Q57298

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you perform calculations using numbers that

contain decimals, you may receive slightly different (more accurate)

results with a math coprocessor present.

MORE INFORMATION

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

If a math coprocessor is not present, Microsoft Excel uses math coprocessor

emulation for its calculations. Calculations using a math coprocessor may

use higher precision and therefore may return a slightly different number

than the same calculation using the emulation.

The difference between emulation and coprocessor is that emulation is done

entirely with double precision floats (8 bytes). The coprocessor may

convert to a higher precision format (extended precision floats (10 bytes))

internally, but we always interface with it with double precision floats.

Therefore although a math coprocessor may give slightly higher precision,

it doesn't always do so. Emulation always gives at least double precision

accuracy.

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q78113

   TITLE     : Excel: Floating-Point Arithmetic May Give Inaccurate Results

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 3.00 4.00 4.00a 5.00

5.00c

FPU


Excel: Using INDEX and MATCH Against Multiple Criteria

Article ID: Q59482

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.2, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

The following article describes a technique to retrieve a value based on

multiple criteria. This might be used, for example, to retrieve a part

price when two fields are necessary to locate a unique part.

MORE INFORMATION

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

Example

-------

Assume you are using the following worksheet:

   A1:  b      B1:  a       C1:  1     D1:  5.00

   A2:  2      B2:  a       C2:  2     D2:  6.00

   A3:         B3:  b       C3:  1     D3:  7.00

   A4:         B4:  b       C4:  2     D4:  8.00

You have defined the following ranges:

   range1 = B1:B4

   range2 = C1:C4

   range3 = D1:D4

Suppose you want to retrieve the price for part "b" "2", for example, with

the input cells being A1 and A2. Place the following formula in cell A3 to

retrieve the desired price:

   =INDEX(range3,MATCH(A2,IF(range1=A1,range2),0))

This formula must be entered as an array formula by pressing

CTRL+SHIFT+ENTER (in Microsoft Excel for Windows and OS/2) or

COMMAND+RETURN (in Microsoft Excel for the Macintosh). In this

example, the returned value is 8.00.

A second approach yields the same results but uses concatenation instead.

This formula may be better for matching against multiple criteria (more

than two) since it does not require nested IF statements:

   =INDEX(range3,MATCH(A1&A2,range1&range2,0))

This formula must also be entered as an array formula. For more information

on the concatenation operator, see "Text, operators in formulas" in the

User's Guide 1 index.

REFERENCES

==========

"User's Guide 1," version 4.0, pages 132, 138

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00


Use of the IRR Function in Excel

Article ID: Q59616

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

If you want to calculate the interest rate you would pay if you took

out a loan for $1000 and paid it back in uneven amounts (for example,

$500, $400, $300, $100) at even intervals, use the IRR (internal rate

of return) function in Microsoft Excel.

MORE INFORMATION

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

Example

-------

The format is

   =IRR(A1:E1)

where the spreadsheet reads as follows:

   A1:     -1000     B1:  500   C1:  400   D1:  300   E1:  100

   A2: =IRR(A1:E1)   B2:        C2:        D2:        E2:

This returns an interest rate of 14.49 percent.

IRR Function Description

------------------------

The IRR function is used to find the discount rate that forces the

current value of a project's inflows to equal the current value of its

costs. This means that the IRR function will find the interest rate

(or rate of return if lending money) that causes the present value of

the inflows from an investment to equal the cost of the investment. It

does this by setting the current value of the cash inflows equal to

the current value of the cash outflows.

The IRR function is commonly used to compare one investment

opportunity with another.

REFERENCES

==========

"Microsoft Excel Functions and Macros," versions 2.x, pages 63-64

"Microsoft Excel Function Reference," version 3.0, pages 134-135

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 2.00 2.0 2.01 2.1 2.10 2.2 2.21 2.20

3.00 3.0 investment irregular money flow 4.00 4.0


Excel and Lotus DIF File Differences

Article ID: Q60997

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

A DIF (Data Interchange Format) file created by Microsoft Excel

differs from one created by Lotus 1-2-3. This may pose a problem for

those programs such as Charting Gallery, which require imported data

to be Lotus DIF compatible.

MORE INFORMATION

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

All parts of Lotus and Excel DIF files are similar except for the

VECTORS and TUPLES entries. The following table would create the

respective VECTORS and TUPLES entries in a DIF file:

    A      B      C       D

  _________________________________

1 |      1989    1988    1987

2 | MARY   10       8       5

3 | SAM     9       8       6

          EXCEL:                LOTUS:

         VECTORS                VECTORS

          0,3                     0,4

         TUPLES                 TUPLES

          0,4                     0,3

In order to make the Microsoft Excel DIF file compatible with the

Lotus format, use a text editor and swap the VECTORS and TUPLES number

entries.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 2.00 2.01 2.10 3.00 4.00


Excel: How to Copy Column Widths

Article ID: Q61269

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for OS/2, versions 2.2 and 3.0

 - Microsoft Excel for the Macintosh, versions 2.2, 3.0, and 4.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can copy the column width when you copy data from

one range of cells to another by selecting the entire column when you copy

it. You can also copy column widths separately from your data.

In versions of Microsoft Excel earlier than version 3.0, there is no direct

way to copy column widths. You can, however, create a macro to copy column

widths along with cell data.

MORE INFORMATION

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

Copying Column Widths in Excel Versions 3.0 and later

-----------------------------------------------------

To copy column widths from one range of cells to another, follow the

appropriate procedure below.

Method 1: To copy column widths along with your data:

          1. Select the columns you want to copy.

              - To select a single column, select the column heading or

                move to any cell in the column and press CTRL+SPACEBAR

                (COMMAND+SPACEBAR if you are using a Macintosh computer).

              - To select more than one column:

                a. Select the first column.

                b. Hold down the SHIFT key and use the arrow keys to select

                   the remaining columns.

          2. From the Edit menu, choose Copy.

          3. Select any cell in your destination range (the range where you

             want to paste your data).

          4. From the Edit menu, choose Paste.

          When you choose the Paste command, Microsoft Excel will paste the

          column widths along with your data.

Method 2: To copy the column widths separately from your data:

          NOTE: This method copies all of the formats, not just the column

          widths, from the selected columns to the destination range.

          1. Copy your data to the new area by selecting only the cells

             that you want to copy and use the Copy and Paste commands.

          2. Select the columns in your source range (the range you are

             copying from).

           - To select a single column, select the column heading or move

             to any cell in the column and press CTRL+SPACEBAR

             (COMMAND+SPACEBAR  for the Macintosh).

           - To select more than one column:

             a. Select the first column.

             b. Hold down the SHIFT key and use the arrow keys to select

                your remaining columns.

          3. Move to the first cell in your destination area (the upper-

             left cell of the area where you pasted your data).

          4. From the Edit menu, choose Paste Special.

          5. In the Paste Special dialog box, select the Formats option.

          6. Choose the OK button.

          When you choose the OK button, Microsoft Excel pastes the column

          formats over the columns in your destination area.

Macro for Copying Column Widths in Excel Versions 2.x

-----------------------------------------------------

The following macro copies the data from a specified source range to a

specified destination range and applies the column width from the

first column in the source range to all the columns of the destination

range.

Microsoft provides macro examples for illustration only, without

warranty either expressed or implied, including but not limited to the

implied warranties of merchantability and/or fitness for a particular

purpose.

Sample Macro

------------

A1: Column_Copy

A2: =GET.CELL(16,ACTIVE.CELL())

A3: =SELECT(OFFSET(ACTIVE.CELL(),0,0,<# Rows>,<# Cols>))

A4: =COPY()

A5: =SELECT(OFFSET(!<DestCell>,0,0,<# Rows>,<# Cols>))

A6: =PASTE()

A7: =COLUMN.WIDTH(A2)

A8: =CANCEL.COPY()

A9: =RETURN()

NOTE: To use this macro you must first select the upper-left cell in your

source range. This cell is the active cell, that is, the currently selected

cell. The following is an explanation of the variables used in the above

macro:

   <DestCell> - The cell in the upper left corner of your destination

                range.

   <# Rows> - The number of rows you want to copy.

   <# Cols> - The number of columns you want to copy.

Line-by-Line Description of the Macro

-------------------------------------

A1: Column_Copy is the name of the macro.

A2: The GET.CELL() function returns the column width of the active

    cell.

A3: Select the source range where:

       <# Rows> is the number of rows you want to copy.

       <# Cols> is the number of columns you want to copy.

A4: Copy the selected range.

A5: Select the destination range, where:

    <DestCell> is the cell in the upper left corner of your

               destination range.

    <# Rows> is the number of rows you want to copy.

    <# Cols> is the number of columns you want to copy.

A6: Paste the copied data in the destination range.

A7: Apply the column width from the first column in the source range

    to all columns in the destination range.

A8: Turn off the moving border around the source range.

A9: End of the macro.

REFERENCES

==========

"Microsoft Excel User's Guide 2," version 4.0,  pages 231-255

For more information about creating macros, see pages 231-255 of the

version 4.0 "Microsoft Excel User's Guide 2."

KBCategory: kbusage

KBSubcategory:

Additional reference words: howto 7.00 5.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20

2.21 3.0 3.00 4.0 4.00


Formula to Find Number of Weekdays Between Dates

Article ID: Q61575

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0,

   5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel version 4.0 and later, use the following formula to

find the number of weekdays between two dates, where A1 equals the

first date first date and A2 equals the second date:

   =NETWORKDAYS(A1,A2)

NOTE: The dates in A1 and A2 must be weekdays, or the result may not

be correct.

In all versions of Microsoft Excel including version 4.0 the following

formula can be used to get the same result as the NETWORKDAYS function:

   =A2-A1+1-INT((A2-A1+1)/7)*2-IF(INT((A2-A1+1)/7)=(A2-

   A1+1)/7,0,IF(WEEKDAY(A2)<WEEKDAY(A1),2,0))-

   IF(OR(WEEKDAY(A1)=1,WEEKDAY(A2)=7),1,0)

MORE INFORMATION

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

The first part of the formula determines the total number of days

between the two dates.

The next section determines the number or whole weeks between the two

dates. This section then multiplies that by two because there is a

Saturday and a Sunday in each whole week.

The last section determines if the range spanned a weekend even though

it was not a whole week. For example, if your start date was on a

Thursday, and your end date was on a Monday, there would be a weekend

in between. The WEEKDAY function would return a 2 for Monday and a 5

for Thursday, so an additional two days are subtracted.

If you are using Microsoft Excel version 4.0 and the NETWORKDAYS

function is not available, you must install the Analysis ToolPak

add-in macro. For more information on managing ad-ins, see "Managing

Add-in Commands and Functions" in Chapter 4 of the "Microsoft Excel

User's Guide 2."

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 5.0 5.00 ATP Tool Pack ToolPack


Manually Recalculating a Single Cell or Range

Article ID: Q61622

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The Calculate Now command on the Options menu causes every cell in the open

worksheet to be recalculated even when calculations are set to manual.

There are several methods to recalculate a single cell or range in

Microsoft Excel that do not cause the entire document to recalculate.

MORE INFORMATION

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

To recalculate a single cell in a worksheet, do the following:

1. Place the cursor in the cell to be recalculated.

2. Press the F2 key.

3. Press ENTER.

The following is another option to recalculate a single cell in a

worksheet:

1. Turn calculation to manual, that is, choose Calculation from the

   Options menu and select the Manual option button. (In version 5.0,

   choose Options from the Tools menu; choose the Calculation tab and

   select Manual.)

2. From the Formula menu, choose Replace. (In version 5.0, choose

   Replace from the Edit menu.)

3. Enter "=" (without quotation marks) into the Replace text box

   and "=" in the With text box.

4. Choose Part from the Look At text box.

5. Choose Replace (not Replace All).

To recalculate a single cell in a macro, use the following example:

   A1: Cell_Recalc

   A2: =CALCULATION(3)

   A3: =FORMULA.REPLACE("=","=",2,1,TRUE)

   A4: =RETURN()

Below is an example to recalculate a range in a macro. This example assumes

there are no arrays in the highlighted range and that the worksheet or

macro sheet with the data to be updated is active when the macro is

started.

   A1: Range_Recalc

   A2: =ROW(SELECTION())

   A3: =ROWS(SELECTION())

   A4: =COLUMN(SELECTION())

   A5: =COLUMNS(SELECTION())

   A6: =FOR("num_of_rows",A2,A2+A3-1)

   A7: =FOR("num_of_cols",A4,A4+A5-1)

   A8: =A12()

   A9: =NEXT()

   A10: =NEXT()

   A11: =RETURN()

   A12: =SEND.KEYS("{F2}~")

   A13: =RETURN()

To recalculate only the cells in a single array, do the following:

1. Select one cell in the array.

2. From the Formula menu (ALT+R), choose Special (S) Current Array (A).

3. Press the F2 key.

4. Press CTRL+SHIFT+ENTER. These steps reenter the formula in the

   array, updating the values they return.

There is an undocumented feature of Microsoft Excel versions 2.0 and 2.1

that allows you to recalculate two noncontiguous regions of a worksheet.

For more information on this feature, query on the following words:

   selective and recalculation and manual and excel

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00


Halting Macro for User Input in Excel

Article ID: Q62290

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.0, 2.1, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

Lotus 1-2-3 allows the use of the "?" (the question mark [without

quotation marks]) to temporarily suspend macro execution while waiting

for your input. Microsoft Excel, however, does not allow halting the

macro to wait for your input without using an INPUT() or similar

command.

To mimic the "?" in a Lotus macro, the following macro segment can be

used to halt a macro to wait for your input, without using an INPUT()

or related function:

   On.time sub-macro to halt macro and wait for user input

   =ON.TIME(NOW()+0.0000000001,"(reference to resume calling macro)")

   =SEND.KEYS("{f2}")

   =RESTART()

   =RETURN()

The RESTART() function tells the macro not to return to the calling

macro. This method is used because the ON.TIME() function is used to

restart the macro in a specified amount of time.

This same method can be used to bring up a dialog box for which Excel

does not provide a macro command, such as the Formula Notes dialog

box. A modification to the SEND.KEYS() function to bring up the

desired dialog box is all that is needed.

   =ON.TIME(NOW()+0.0000000001,"(reference to resume calling macro)")

   =SEND.KEYS("(%r)n")

   =RESTART()

   =RETURN()

NOTE: the information above also applies to version 5.0 and later only when

using version 4.0 macro language.

KBCategory: kbusage kbmacro

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00 pause pausing


Sorting on Portions of the Contents of a Cell

Article ID: Q62719

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0

 - Microsoft Excel for the Macintosh, versions 1.5, 2.2, 3.0, 4.0,

   5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

Microsoft Excel cannot sort information based on a portion of a cell's

contents; however, if the information in the cell is text, you can use text

functions to extract the desired sorting criteria to an adjacent column,

then sort the adjacent column.

MORE INFORMATION

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

For example, consider the following cells:

   -|--------A--------|------B------|

   1|123 123 4432 2222|             |

   2|432 564 3254 6666|             |

   3|325 754 0074 1111|             |

   4|677 431 8944 3333|             |

To sort by only the last four digits of the cells, use the following

formula in column B to extract only those last characters

   =RIGHT(cell-to-left,4)

where "cell-to-left" refers to A1, A2, A3,  and A4.

This formula produces the following:

   -|--------A--------|-----B------|

   1|123 123 4432 2222|    2222    |

   2|432 564 3254 6666|    6666    |

   3|325 754 0074 1111|    1111    |

   4|677 431 8944 3333|    3333    |

Select both columns of data, and sort with B1 as the first sort key. (In

version 5.0, it is not necessary to select both columns of data.) Column A

is now sorted by the last four digits. The following results:

   -|--------A--------|-----B------|

   1|325 754 0074 1111|    1111    |

   2|123 123 4432 2222|    2222    |

   3|677 431 8944 3333|    3333    |

   4|432 564 3254 6666|    6666    |

Middle digits can be found using the MID() function. For example, to sort

by the third set of numbers in the above data, use the following formula,

which extracts four characters beginning with the ninth digit:

   =MID(cell-to-left,9,4)

REFERENCES

==========

"Function Reference," version 4.0, pages 274 and 363-364

"Function Reference," version 3.0, pages 151-152 and 200

KBCategory: kbusage

KBSubcategory:

Additional reference words: 1.5 1.50 2.0 2.00 2.01 2.1 2.10 2.2 2.20

2.21 3.0 3.00 4.0 4.00 5.0 5.00


Excel: Locating Circular References

Article ID: Q65362

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 1.x, 2.2, 3.x, 4.x, 5.0

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

A circular reference exists when formulas refer to and are dependent on

each other. For example, if cell A1 contains the formula "=B1" and cell B1

contains the formula "=A1", a circular reference has been created because

both formulas depend on each other for their answer.

If you create a circular reference in Microsoft Excel, you receive the

error message "Can't Resolve Circular References" when you enter the

formula. The status bar then displays the following message where

"cell_ref" is part of the circular reference:

   Circular: cell_ref

If you have more than one worksheet open in Microsoft Excel and the status

bar displays only "Circular" (without quotation marks), then one of the

other open worksheets has a circular reference. You need to activate each

worksheet in turn until the status bar displays the "Circular: cell_ref"

message.

WORKAROUNDS

===========

To find all cells involved in the circular reference, do the following:

Microsoft Excel Version 5.0 and later

-------------------------------------

Menu Method

1. Select the cell whose cell reference is displayed in the status bar.

2. From the Edit menu, choose Go To, and then choose the Special button.

3. Select the Precedents option, and then select the All Levels option.

   Choose OK.

All cells for this circular reference are highlighted on the worksheet.

Continue this procedure until all circular references have been found.

Toolbar Method

1. Select the cell whose cell reference is displayed in the status bar.

2. From View menu, choose Toolbars.

3. From the Toolbars list, select the Auditing check box, and choose OK.

4. From the Auditing Toolbar, choose the Trace Precedents button. Click the

   Trace Precedents button until the system beeps, indicating that there

   are no more precedents.

Each time you click the Trace Precedents button, an arrow is drawn to an

additional level of precedence.

Visual Basic Method

1. In a new module, enter the following:

      Sub Example()

         ActiveSheet.CircularReference.Select

         ActiveCell.Precedents.Select

      End Sub

2. Select the sheet tab of the worksheet that contains the circular

   reference, and run the Example macro.

All cells for this circular reference are highlighted on the worksheet.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Microsoft Excel Versions 4.0 and Earlier

----------------------------------------

1. Select the cell whose cell reference is displayed in the status bar.

2. From the Formula menu, choose Select Special.

3. Select the Precedents option, and then select the All Levels option.

   Choose OK.

All cells for this circular reference are highlighted on the worksheet.

Continue this procedure until all circular references have been found.

Microsoft Excel 1.5 and Earlier

-------------------------------

In Microsoft Excel versions 1.5 and earlier, the error message "Can't

Resolve Circular References" will be displayed if formulas refer to each

other in a circular manner.

To find all cells involved in the circular reference, do the following:

1. From the Options menu, choose Calculation.

2. Select Manual.

3. Select Iteration.

4. Enter at least 100 (default) in the Maximum Iterations box.

5. Choose the OK button.

6. From the Options menu, choose Calculate Now or press COMMAND+= on

   the keyboard.

7. Look at the screen for any numbers that are changing rapidly or

   "flashing." These cells contain circular references and Microsoft

   Excel is performing iterative calculations on these formulas,

   changing the cell value with each iteration.

8. If this is a large worksheet, scroll to view another portion of the

   sheet and repeat steps 6 and 7. Continue checking each portion of

   the worksheet until all circular references are found.

MORE INFORMATION

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

By default, the status bar is displayed in Microsoft Excel versions 5.0,

4.0, 3.0 and 2.2. To display the status bar at the bottom of the screen in

Microsoft Excel version 5.0, choose Status Bar from the View menu. In

Microsoft Excel versions 4.0 and earlier, choose Workspace from the Options

menu, select the Status Bar check box, and choose OK.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 1.00 1.03 1.04 1.06 1.50 2.20 2.21 3.00

4.00 5.00


How to Calculate the Number of Months Between Two Given Dates

Article ID: Q67093

-------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

-------------------------------------------------------------------

SUMMARY

=======

To calculate the number of months between any two given dates, use the

following formula (where EDate=Earlier Date and LDate=Later Date):

  =(Year(LDate)-Year(EDate))*12 + Month(LDate)-Month(EDate)

NOTE: If LDate and/or EDate are entered directly into this formula

instead of into their cell references, they would need to have double

quotation marks around them (for example, "9/7/88").

Days are not taken into consideration. For example, given a start date

of 10/31 and an end date of 11/2, one month will be returned. Years

are taken into consideration. This function can be useful for people

who need to calculate the number of months that have passed since a

particular starting date.

For example, the following formula results in an answer of 11:

   =(Year(Now())-Year("11/2/89"))*12 + Month(Now())-Month("11/2/89")

NOTE: This example assumes Now() refers to October 1990.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 2.0 2.00 2.1 2.10 2.2 2.20 3.0 3.00

4.0 4.00


Excel Macro to Print All Open Documents

Article ID: Q67571

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

The following Visual Basic procedure (version 5.0 only) and Microsoft Excel

macro will batch print all the documents that are currently open in

Microsoft Excel:

Visual Basic Procedure

----------------------

The following procedure prints all of the sheets in each open workbook in

Microsoft Excel version 5.0.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

   Sub Print_All()

      Dim n As Integer

      Dim c As Integer

      ' Find number of open workbooks

      n = Application.Workbooks.Count

      'Loop through and print each open workbook

      For c = 1 To n

         Application.Workbooks(c).PrintOut

      Next c

   End Sub

Microsoft Excel Macro

---------------------

(Note that if you run this macro in Microsoft Excel version 5.0, only the

active sheet in each open workbook will print)

1. The macro sheet name enclosed in quotation marks in cell A5 must be

   the name of the macro sheet on which you put this macro. This is so

   the macro will not print itself.

2. The Windows version 3.0 print spooler imposes a 20-file limitation. This

   macro does not check for circumstances exceeding this maximum. Normally,

   this should not be a problem because it is close to the maximum

   number of documents Microsoft Excel can have open (Read/Write under

   Windows 3.0). Chances are that the spooler will have completed

   printing some of the files by the time Microsoft Excel sends all

   the documents to the spooler. The limit in Windows version 3.1 is 100

   print jobs.

3. If the 20-file limitation does pose a problem in practice, the WAIT

   function may be used to allow the spooler some additional time to

   send a file to the printer before Microsoft Excel sends another

   document to the spooler. The following line may be inserted between

   cells A5 and A6:

      =WAIT(NOW()+TIMEVALUE("00:02:00"))

   This line will cause the macro to pause for 2 minutes before

   sending the next document.

NOTE: Microsoft provides macro examples for illustration only, without

warranty either expressed or implied, including but not limited to the

implied warranties of merchantability and/or fitness for a particular

purpose. This macro is provided 'as is' and Microsoft does not

guarantee that the following code can be used in all situations.

Microsoft does not support modifications of the code to suit customer

requirements.

The following is the macro:

A1: Print_Docs

A2: =COLUMNS(DOCUMENTS())

A3: =FOR("Count",1,A2,1)

A4: =ACTIVATE(INDEX(DOCUMENTS(),1,Count))

A5: =IF(GET.DOCUMENT(1)<>"macro1.xlm",PRINT())

A6: =NEXT()

A7: =RETURN()

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 3.00 4.00 5.00


Setting and Removing a Noncontiguous Print_Area

Article ID: Q68200

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, to set a print area that contains adjacent or

nonadjacent cells or cell ranges on a worksheet, do the following:

Microsoft Excel versions 5.0 and later

--------------------------------------

1. From the File menu, choose Page Setup. Select the Sheet tab.

2. With your cursor in the Print Area box in the Page Setup dialog, select

   the area or areas on your worksheet that include all the sections you

   would like to print. Select the areas by pressing CTRL while you drag

   your mouse, or use the F8 and SHIFT+F8 key sequences. If you select

   nonadjacent areas, each area will be printed on its own page.

Microsoft Excel versions 2.x, 3.0 and 4.0

-----------------------------------------

1. Select the area or areas that include all the sections you would

   like to print. Select the areas by pressing CTRL while you drag

   your mouse, or use the F8 and SHIFT+F8 key sequences. If you select

   nonadjacent areas, each area will be printed on its own page.

2. Choose Set Print Area from the Options menu. At this point, the

   print area has been set.

MORE INFORMATION

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

If you would like to view, modify, or delete your print area, do the

following:

Microsoft Excel versions 5.0 and later

--------------------------------------

1. From the Insert menu, choose Name, and then choose Define.

2. From the Names In Workbook list, select SheetName!Print_Area (where

   SheetName is the name of your worksheet.) The individual cell or range

   references appear separated by commas in the Refers To box, similar to

   the following:

      =$A$1,$B$1:$C$1,$K$4

   The cells or cell ranges that are separated by commas print on

   separate pages.

To delete the print area, select Print_Area from the Names In Workbook

list, and choose Delete.

To modify the print area, select "Print_Area" from the Names In Workbook

list, and change the reference in the Refers To box.

Microsoft Excel versions 2.x, 3.0 and 4.0

-----------------------------------------

1. From the Formula menu, choose Define Name. From the Names In Sheet list,

   select Print_Area. The individual cell or range references appear

   separated by commas in the Refers To box, similar to the following:

      =$A$1,$B$1:$C$1,$K$4

   The cells or cell ranges that are separated by commas print on

   separate pages.

To delete the print area, select Print_Area from the Names In Sheet list,

and choose Delete.

To modify the print area, select "Print_Area" from the Names In Sheet list,

and change the reference in the Refers To box.

For more information on selecting nonadjacent ranges, query on the

words:

   Multiple and Selections and Add

REFERENCES

==========

"Microsoft Excel Reference Guide," page 581

KBCategory: kbprint

KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 3.0 3.00 4.0 4.00 5.00

discontiguous noncontiguous


Contents of Cells Show Through Objects with HP Printers

Article ID: Q68269

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Windows, versions 3.0, 3.1

--------------------------------------------------------------------

SUMMARY

=======

When an object is placed on top of a cell that contains information,

the contents of the cell will show (bleed) through when the worksheet

is printed from a Hewlett-Packard (HP) printer. The object will block

the gridlines but the cell contents or data will print over the

object. Print preview appears correctly.

This is due to the way that the HP Printer Control Language (PCL) is

written (any printer driver using PCL will display this way).

Workarounds

-----------

There are several ways to work around this problem. If the cells are

formatted using Modern, Roman, or Script, text does not bleed through.

If you format the text as white, the text will not display.

There is also another workaround available. If you have Adobe Type

Manager (ATM) fonts version 1.1 or Bitstream fonts version 1.2, you

can format the cells with one of the ATM or Bitstream fonts to prevent

the text from bleeding through.

You can also avoid the problem if you are using an HP Laserjet IIP, by

setting true-type as graphics which also prints the text box as an

opaque box.

An alternate workaround is to use a TrueType font and print TrueType

as Graphics. From the File menu choose Page Setup. From the Page Setup

dialog, choose Printer Setup, then choose Setup and then Options.

Select Print TrueType as Graphics.

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 5.00 3.0 3.00 3.1 3.10 4.0 4.00 Rectangle

Oval Line Arc Picture Square TEXT BOX LaserJet Laser Jet Circle

Chart Overlap


XLM: Opening and Closing Word for Windows Using an Excel Macro

Article ID: Q68510

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

----------------------------------------------------------------------

In Microsoft Excel, you can write a macro that will open and close

Microsoft Word for Windows from Microsoft Excel. To create this macro,

do the following:

1. Write a macro that will create an open channel number.

2. Run Word for Windows.

3. Close Word for Windows.

4. Close the open channel number.

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided 'as is' and Microsoft does not guarantee that the

following code can be used in all situations. Microsoft does not support

modifications of the code to suit customer requirements.

Sample Macro 1

--------------

The following sample Microsoft Excel macro, starts Word for Windows,

initiates a DDE channel using the topic "System," and terminates the open

channel number:

A1:  =EXEC("winword")

A2:  =INITIATE("winword","system")

A3:  =EXECUTE(A2,"[FileExit(1)]")

A4:  =TERMINATE(A2)

A5:  =RETURN()

NOTE: This macro assumes that Word for Windows is in your path.

Sample Macro 2

--------------

The following Microsoft Excel macro, initiates a DDE Channel to Microsoft

Word for Windows. In addition, it checks to see if Word for Windows is

currently running. If it is, the macro initiates the channel to the current

session of Word. This eliminates the problem of multiple instances of Word

for Windows being opened unnecessarily. If Word for Windows is not running

the macro starts Word.

A1: =SET.NAME("HANDLE",REGISTER("kernel","getModuleHandle","IC"))

A2: =SET.NAME("CALLVALUE",CALL(Handle,"WINWORD.EXE"))

A3: =IF(CallValue=0)

A4: =EXEC("WINWORD.EXE")

A5: =END.IF()

A6: =INITIATE("WINWORD","SYSTEM")

A7: =RETURN()

Note: this is also true for Microsoft Excel version 5.0 macro sheets when

you use version 4.0 macros.

REFERENCES

==========

"Function Reference," version 4.0, pages 240-241

"Function Reference," version 3.0 for Windows, pages 130-131

"Functions and Macros," version 2.0 for Windows, page 307

"Microsoft Word for Windows Technical Reference," page 49

KBCategory: kbother

KBSubcategory: kbfasttip

Additional reference words: 2.0 2.00 2.01 2.1 2.10 3.00 4.00


Printing Nonadjacent Areas on One Sheet

Article ID: Q68511

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a, 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

If you set a print area that consists of multiple nonadjacent areas, but

you want to print the areas on one page, Microsoft Excel will print each

separate area on a separate page.

To work around this behavior, hide the columns and rows between the areas

and set a single, continuous print area to print everything on one page.

MORE INFORMATION

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

In certain cases, this workaround will not work. For example, if you have

one area to the right of another, and you want these areas printed one

above the other, the typical workaround would be to copy the second area

below the first and set a single print area. However, if your column widths

do not align correctly, this workaround will not work.

If you are using Microsoft Excel version 5.0 or earlier

-------------------------------------------------------

Use the following steps to take a picture of the second area and place it

below the first:

1. Highlight the second area.

2. Click the Camera tool on the Utility toolbar.

3. Place the insertion point in the appropriate position below the first

   area and click the mouse. A picture of the second area will be placed

   below the first.

4. Set a new print area that contains the picture.

REFERENCES

==========

"User's Guide 2," version 4.0, page 512

"Microsoft Excel User's Guide," version 3.0, page 522

KBCategory: kbprint kbusage

KBSubcategory:

Additional reference words: 5.00 3.0 3.00 4.0 4.00 contiguous noncontiguous

discontiguous


XLM: How to Create International Macros in Excel

Article ID: Q69527

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

With Excel 2.x, macros often have to be manually translated for them

to run in different language versions of Excel. Starting with Excel

version 3.0, there is a new type of macro sheet format --

International Macro -- that solves this problem, making it easier for

global accounts to transfer macros between countries. Macros can be

created in the International Macro format from any language version of

Excel. They can then be run, without going through any conversion

process, in any other language version of Excel. That is, foreign

language versions of Excel have been designed to understand English

functions.

In the United States

--------------------

If you have a U.S. version of Microsoft Excel, you can save a macro as an

International Macro by using the Save As command under the File menu

and selecting the Int'l Macro option. Macros created in Excel 2.x or

in Excel 3.0's or 4.0's standard macro format can be saved for

international use in this way. The International Macro will run

without modification in different language versions of Excel 3.0 and later.

NOTE: This information applies to Microsoft Excel 5.0 and later ONLY if you

are using XLM macrosheets.

It may make sense to translate quoted text strings, such as

input requests or error messages, into the local language.

Outside of the United States

----------------------------

If you have a non-U.S. version of Excel, you can create a NEW

International Macro by using the New command under the File menu and

selecting the Int'l Macro option. All functions and formulas need to

be in English, with U.S. country settings. This International Macro

will run without modification in different language versions of Excel.

NOTE: Again, it may make sense to translate quoted text strings.

The Int'l Macro option only appears in the New dialog box (accessed

by choosing New from the File menu) when Excel is used with a non-U.S.

country setting selected in the Windows or OS/2 Control Panel, or with

non-U.S. Macintosh system software.

Users outside of the U.S. can save an EXISTING macro created in

non-English versions of Excel (either 2.x, 3.00, or 4.00's Standard

macro format) as an International Macro using the Save As command from

the File menu. Functions and formulas will be converted to English,

with U.S. country settings. However, it will be necessary to manually

convert text arguments within certain functions for the macro to run

with other language versions of Excel.

For more information about the International Macro feature, query on

the word "intmac" (without the quotation marks).

REFERENCES

==========

"User's Guide 2," version 4.0, pages 297-299

"User's Guide," version 3.0, pages 655-658

KBCategory: kbprg kbmacro

KBSubcategory:

Additional reference words: 7.00 3.00 3.0 4.00 4.0 foreign intmac


Using SEND.KEYS() to Change Paper Source in Printer Setup

Article ID: Q69614

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0

----------------------------------------------------------------------

SUMMARY

=======

The following macro will change the paper source to "lower tray" on

the Helwett-Packard (HP) LaserJet IIP:

   A1: =SEND.KEYS("%(S)~%(S){PGUP}{DOWN}~~")

   A2: =PRINTER.SETUP?()

   A3: =RETURN()

This macro sends keystrokes to the Printer Setup dialog box. The

following is an explanation of the string used in the SEND.KEYS()

function:

   Command        Description

   -------        -----------

   %(S)           Chooses Setup

   ~              Chooses OK (Excel 3.00 only, see below **)

   %(S)           Selects "paper source"

   {PGUP}         Moves selection to the top to choose "upper tray"

   {DOWN}         Moves selection down one time to choose "lower tray"

   ~~             Chooses OK twice to enter the changes.

** This is only needed in Microsoft Excel version 3.0 with printers

   that support extended printer attributes accessible in Page Setup

   from the File menu. Epson printer drivers, for example, do not

   support these attributes; therefore, the tilde is not necessary.

   If you are not sure if your printer has these attributes, you can

   manually choose Printer Setup from the File menu and choose the

   setup button. If a dialog box is displayed with the following

   message, you need the tilde:

      This command controls default printer settings for all documents

      and all applications. Use File Page Setup to set Orientation,

      Paper Size, and Scaling for individual documents.

MORE INFORMATION

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

In the Printer Setup dialog box, there is no accelerator key combination

that will directly select a paper source such as "lower tray." Instead,

the arrow keys should be used to select from the list of sources

available. On the HP LaserJet IIP, for example, there are four possible

choices for the paper source:

 - Upper tray

 - Lower tray

 - Manual feed

 - Envelope

The problem is that the current selection is unknown. The following may

be the easiest way to select the right choice from the paper source

list:

1. Assume that the current selection is not known. To change that

   assumption, select the first source ("upper tray"). PGUP will

   guarantee that "upper tray" is selected.

   Use "{PGUP}" (without the quotation marks) in the SEND.KEYS string.

2. Note how many times you want to use the {DOWN} string. The

   following is an example:

      none                 for "Upper tray"

      {DOWN}               for "Lower tray"

      (DOWN){DOWN)         for "Manual feed"

      {DOWN}{DOWN}{DOWN}   for "Envelope"

Notes

-----

1. The number of {DOWN} entries equals the choice number in the list

   box, minus one (that is, number of {DOWN} entries = [choice number

   in list box] - 1).

2. It is assumed that the right printer is selected.

3. Do not use the STEP() function before this macro or the keys sent

   will not work.

REFERENCES

==========

"Function Reference," version 4.0, page 385

"Microsoft Excel Function Reference," version 3.0, pages 214-215.

"Microsoft Excel for Windows Functions and Macros," version 2.1x, pages

353-254, 373-375

KBCategory: kbprint kbmacro

KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 3.0 3.00 4.0 4.00


Using FORMULA.CONVERT() to Change Relative/Absolute References

Article ID: Q70096

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

You can use the FORMULA function with the FORMULA.CONVERT function to

change every reference in a selected area from relative to absolute

reference. You can do this by using the FORMULA.CONVERT function to

calculate the first argument, formula_text, of the FORMULA function.

However, because the FORMULA function will fail if you attempt to use

A1-style references, you need to make sure that the FORMULA.CONVERT

function is returning an R1C1-style formula and not an A1-style

formula.

MORE INFORMATION

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

The third argument of the FORMULA.CONVERT function, To_a1, determines

whether an A1-Style or R1C1-style reference is returned.

Example

-------

The following macro is a short example that will convert all the

references in the currently selected area into absolute

references.

NOTE: This macro assumes that the references in the selected area are

currently in A1-style. If you want to select an area that contains

relative references in R1C1-style, change the second argument of the

FORMULA.CONVERT function from TRUE to FALSE.

   A1: =FOR.CELL("curcell",,TRUE)

   A2: =FORMULA(FORMULA.CONVERT(GET.CELL

        (6,curcell),TRUE,FALSE,1,curcell),curcell)

   A3: =NEXT()

   A4: =RETURN()

1. The FOR.CELL function starts a For.Cell-Next loop that will loop

   through the currently selected area. "curcell" is just the ref_name

   given to the new cell through each loop.

2. The second line converts each reference in the selected range to an

   absolute references in R1C1-style, and then places it back into the

   current cell of the selection. If you wanted the macro to change

   absolute references to relative references, you would replace the

   fourth argument of the FORMULA.CONVERT function from 1 to 4. You

   must also include curcell as noted above otherwise, it will convert

   references based directly on the macro sheet rather than the

   worksheet cells.

NOTE: The third argument of the FORMULA.CONVERT function must be FALSE to

use the FORMULA.CONVERT function to return the formula_text argument to the

FORMULA function. If this third argument is TRUE, or if the formula_text

argument uses A1 style references and this third argument is omitted, you

will receive a macro error.

REFERENCES

==========

"Function Reference," version 4.0, pages 168-171

"Microsoft Excel Function Reference," version 3.0, pages 89-91

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 5.00 sort


Paste Linking an Excel Embedded Chart into Word for Windows

Article ID: Q70471

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you create an embedded chart in Microsoft Excel, you can paste link

the chart to a Microsoft Word for Windows document. It isn't necessary to

create a separate chart file to do this.

MORE INFORMATION

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

To paste link the embedded chart into Word for Windows, do the

following:

1. Double click the embedded chart object to activate the chart.

2. In Microsoft Excel versions 3.0 and 4.0, choose Select from the Chart

   menu.

3. In Microsoft Excel versions 4.0 and 5.0, choose Copy from the Edit menu.

   In Microsoft Excel version 3.0, hold down the SHIFT key and choose Copy

   Picture from the Edit menu. Select the desired options, and choose OK.

4. Start Microsoft Word for Windows, and choose Paste Special from the Edit

   menu.

5. In Microsoft Word for Windows version 6.0, select Picture from the As

   list. Select the Paste Link option, and choose OK.

   In Microsoft Word for Windows version 2.x, select Picture from the Data

   Type list, and choose the Paste Link button.

NOTE: this method only works if the worksheet is open in Microsoft Excel

when you update the linked chart in Word for Windows. If you double click

the chart in Word and Microsoft Excel is not running, nothing happens.

REFERENCES

==========

"Microsoft Excel User's Guide," version 3.0, pages 316-319

KBCategory: kbinterop

KBSubcategory:

Additional reference words: 7.00 2.00 2.00a 2.00b 2.00c 3.00 4.00 5.00 6.00

6.00a DDE OLE officeinterop


Excel: Graphic Objects Affect Printout of Shaded Cells

Article ID: Q71268

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

The printing resolution of some cell patterns may differ in texture on

some Hewlett-Packard (HP) printers, depending on whether or not a

graphical object has been attached to the worksheet. For example, the 3D

AutoFormat is printed incorrectly on the HP LaserJet IIIP unless a

graphical object is attached.

Note that this problem may occur with other printers as well.

WORKAROUND

==========

1. Select the rectangle tool from the tool bar and place a rectangle

   near the shaded cells on the second page.

2. From the Format menu, choose Patterns.

3. Set both the Border and Fill options to none.

Because both pages now contain graphical objects, the resolution will now

appear the same on both pages.

The 3D AutoFormat uses white lines. The HP LaserJet IIIP, for example,

prints colored lines as black when no graphical objects are on the sheet.

STATUS

======

Microsoft is researching this problem and will new information here in the

Microsoft Knowledge Base as it becomes available.

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 5.00


Consolidation Does Not Consolidate Text in Excel

Article ID: Q71303

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The Consolidation feature of Microsoft Excel will not consolidate

text. The only text that Consolidation will bring across is Category

Titles. Titles are brought into the destination sheet when you select

Top Row or Left Column from the Consolidate dialog box. Any other text

in the source areas is not brought across. If the source areas contain

text other than Category Titles, blanks are brought into the

destination area.

MORE INFORMATION

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

Steps to Reproduce Problem

--------------------------

1. Insert the following information into a spreadsheet. This information

   is your first source area.

        A1:  NAME       B1:  STATE      C1:  AMOUNT

        A2:  KEN        B2:  NC         C2:  5.00

        A3:  DALE       B3:  NC         C3:  5.00

        A4:  WILSON     B4:  NC         C4:  5.00

2. Insert the following information into a second spreadsheet. This

   information is your second source area.

        A1:  NAME       B1:  AMOUNT

        A2:  KEN        B2:  5.00

        A3:  DALE       B3:  5.00

        A4:  WILSON     B4:  5.00

3. Save these sheets as SHEET1.XLS and SHEET2.XLS, respectively.

4. In a third sheet (the destination area), do the following:

   a. Select cell A1.

   b. From the Data menu, choose Consolidate.

   c. Select SUM from the Function box.

   d. Select Top Row.

   e. Select Left Column.

   f. In the Reference box, type "sheet1.xls!$A$1:$C$4" (without the

      quotation marks).

   g. Choose Add.

   h. In the Reference box, type "sheet2.xls!$A$1:$B$4".

   i. Choose Add.

   j. Choose OK.

The destination area should now contain the values listed below:

  A1:  NAME       B1:  STATE      C1:  AMOUNT

  A2:  KEN        B2:             C2:  10.00

  A3:  DALE       B3:             C3:  10.00

  A4:  WILSON     B4:             C4:  10.00

The category title "STATE" is listed, but the cells below it are

empty. This is not a problem with Excel. The function that Excel

consolidates with, by default, is the SUM function. Because the SUM

function cannot be applied to text values, no values are brought into

the destination area.

REFERENCES

==========

"Online Help," version 5.0

"User's Guide 1," version 4.0, pages 374-383

"User's Guide," version 3.0, pages 328-334

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.2 2.20 2.21 3.0 3.00 4.0 4.00 5.0 5.00


Activating An Embedded Chart Using A Macro

Article ID: Q71539

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

You can create an embedded chart object using the chart tool on the

Standard Toolbar. You must create an embedded chart in the instance of

Microsoft Excel that contains the supporting data. The embedded chart is

then dynamically linked to this data.

To add a legend, title, etc. to your embedded chart, you must activate the

chart object. You can do this by double-clicking anywhere on the chart

object. In Microsoft Excel version 5.0, when you activate an embedded

chart, a hatched border appears around the chart and you can format the

chart elements.

In Microsoft Excel versions 3.0 and 4.0, when you activate an embedded

chart, a copy of the chart object opens in a new window. This new window

displays the chart menu bar, allowing you to format the chart elements. The

embedded chart on the worksheet immediately reflects all changes made to

the copy in the window.

You can also activate an embedded chart object using a macro as in the

following examples:

Microsoft Excel version 5.0 Visual Basic Example

------------------------------------------------

   ' Dimension variable

   Dim Data As String

   ' Assign variable Data to selected cells

   Data = Selection.Address

   ' Create embedded chart from selected data

   ActiveSheet.ChartObjects.Add(82.8, 76.8, 321.6, 100.2).Select

   ActiveChart.ChartWizard Source:=Range(Data)

   ' Activate embedded chart for editing

   Selection.Activate

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

Microsoft Excel versions 3.0 and 4.0 Macro

------------------------------------------

   A1: =COPY()

   A2: =CREATE.OBJECT(5,!$B$5,5,5,!$D$15,5,5)

   A3: =DEFINE.NAME("Temp")

   A4: =GET.NAME("!Temp")

   A5: worksheet=GET.DOCUMENT(1)

   A6: =UNHIDE(worksheet&" "&A2)

   A7: =RETURN()

This macro does the following:

1. Copies the selected data for the chart from the worksheet

2. Creates the embedded chart

3. Assigns the name "Temp" to the chart object

4. Gets the definition of the name "Temp"

5. Assigns the name "worksheet" to the name of the worksheet

6. Activates the chart object

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided 'as is' and Microsoft does not guarantee that the

following code can be used in all situations. Microsoft does not support

modifications of that code to suit specific customer requirements.

REFERENCES

==========

"User's Guide," version 4.0, page 394-399, 435

"User's Guide," version 3.0, page 325, 391-394

"Function Reference," version 4.0, pages 65-66, 77-79, 196, 201, 441

"Function Reference," version 3.0, pages 36, 40, 107, 111, 241

KBCategory: kbprg kbmacro

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 5.0 5.00


Copying a Multiple Selection in Excel

Article ID: Q71696

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you attempt to copy noncontiguous areas in Microsoft Excel, you get an

error message that says "Cannot Do That Command on A Multiple Selection."

However, Microsoft Excel versions later than 2.0 allow you to copy multiple

selections if the selections are linear and no error message will result.

MORE INFORMATION

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

In Microsoft Excel versions later than 2.0, you are allowed to copy a

multiple selection if the individual selections are aligned either

vertically or horizontally and have the same number of rows and/or

columns. For example, the multiple selection containing A1:A5, C1:D5,

and F1:F5 is linear. The multiple selection A1:E1 and B3:F3 is not

linear because this selection is not aligned either horizontally or

vertically. A good rule of thumb to follow is to make sure that either

the row numbers OR column numbers are identical in the individual

selections.

REFERENCES

==========

Online Help, "nonadjacent cells, selecting"

"User's Guide 1," version 4.0, pages 95-98

"User's Guide," version 3.0, page 77-79

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 5.0 5.00 noncontiguous discontiguous


Excel: "Can't Access Document" Error Opening or Saving File

Article ID: Q71730

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 2.x, 3.0, 4.0, 5.0, 5.0c

 - Microsoft Excel for OS/2, version 2.2, 3.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you open or save a file, you may receive the error

message "Can't Access Document."

CAUSE

=====

This error message appears if Microsoft Excel is unable to access the file

for any reason. For example, you receive this error message when you save a

file to a floppy disk drive when the floppy disk is write-protected. In

this case, you can remove the protection and save the file again.

If you receive this error message for any other reason, press the F1 key on

your keyboard. Microsoft Excel will display reasons why this error message

may have occurred. Or you can select Messages or Alert Messages from the

Index portion of the Help menu to view this information.

MORE INFORMATION

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

Note that in Microsoft Excel version 7.0, if you save a file to a write

protected floppy disk, you receive the following descriptive error message

   Cannot save. The device is write protected.

KBCategory: kberrmsg

KBSubcategory:

Additional reference words: 2.00 2.01 2.10 2.20 2.21 3.00 4.00 5.00 5.00c


Using IPMT to Calculate Interest Paid for Multiple Periods

Article ID: Q71952

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The IPMT function returns the interest payment for a single given period

for an investment based on periodic and constant payments, and a constant

interest rate.

To calculate the total interest paid over a range of time (multiple

periods), the IPMT function can be used in an array formula as described

below.

If you are using Microsoft Excel version 4.0, you can use the CUMIPMT

function which will return the cumulative interest paid on a loan between

start_period and end_period.

MORE INFORMATION

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

For example, let's say you want to determine the total interest paid

for the first year (periods 1-12), assuming an annual interest rate of

13 percent, the number of periods is equal to 360 months, and the

present value is equal to -$100,000.

 Enter the following

in a worksheet:

    A1:   Total interest paid in Year 1

    A2:   {=SUM(IPMT(13%/12,ROW(A1:A12),360,-100000))}

Enter the formula in cell A2 as an array formula by pressing

CTRL+SHIFT+ENTER. Do not type the {}s manually. $12,983.05 is the value

returned in cell A2.

The ROW() function is used in this formula to return an array of period

numbers and any range can be used here. In this example, ROW(A1:A12)

returns {1;2;3;4;5;6;7;8;9;10;11;12}.

This method works for any other range of periods. For example, to calculate

the interest paid for the second year, type the range A13:A24 in place of

A1:A12 in the ROW() function.

REFERENCES

==========

"Online Help," version 5.0

"Function Reference," version 4.0, page 246

"Function Reference," version 3.0, page 133

"Functions and Macros," version 2.x, page 310

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00


Solver Error Messages

Article ID: Q72415

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

The following is a complete list of Solver error messages. Note that

these error messages are all documented in the "User's Guides" on the

pages listed at the bottom of this article.

Error Messages

--------------

Active document is not a worksheet.

By Changing Cells must be on the active sheet.

Cannot communicate with Solver application.

Cannot find SOLVER.XLA.

Cannot find REPORT.XLA.

Cell named in the Cell Reference box must contain a formula.

Cell Reference box is empty or contents are not valid.

Constraint must be a number, a reference, or a formula.

Load Model: Adjustable Cells reference not valid.

Load Model: Constraint formula not valid.

Load Model: Set Cell formula not valid.

Load/Save Model: Selection must be multiple cells.

Macro sent invalid problem.

Microsoft Excel did not respond in time.

Memory allocation error.

No constraint to change.

No constraint to delete.

Precision must be a small positive number.

Problem to solve not specified.

Reset all Solver options and cell selections?

Reset previous Solver cell selections?

Save Model: Selection could not hold all constraints.

Set Cell contents must be a formula.

Set Cell must be a single cell on the ACTIVE sheet.

Solver interrupted; choose Formula Solver to resume.

Solver: OK to continue iterations, Cancel to stop.

Solver to Microsoft Excel communication error.

Too many adjustable cells.

Too many constraints.

Solver cannot improve the current solution. All constraints are

satisfied.

Solver could not find a feasible solution.

Solver encountered an error value in a target or constraint cell.

Solver stopped at user's request.

The linearity condition is not satisfied. Turn off the Assume Linear

Model check box and then run Solver again.

The maximum time or iteration limit was reached.

The values do not converge.

REFERENCES

==========

"User's Guide 2," version 4.0, pages 79-120

"Microsoft Excel Solver User's Guide," version 3.0, pages 20-21, 47-50

KBCategory: kberrmsg

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 5.0 5.00


Parsing Names in a Worksheet Without Data Parse in Excel

Article ID: Q72573

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

You can parse data into separate cells by entering formulas into the first

row of a worksheet and filling those formulas down. In those cases where

using the Data Parse command isn't working properly, and you do not want to

write a macro, this may be desirable.

MORE INFORMATION

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

The following example will accept names and parse the names into three

columns (first name, middle initial, last name), skipping the middle

initial column if no middle initial exists.

NOTE: The Microsoft Excel version 3.0 and 4.0 FLATFILE.XLA Data Smart Parse

command will parse in a similar way, except that it does not skip any

columns.

Example

-------

Enter the following names into the appropriate cells:

   A1:  Mary J. Smith

   A2:  Joshua Johnston

Enter the following formulas into the appropriate cells:

   B1:  =SEARCH(" ",A1)

   C1:  =SEARCH(" ",A1,SEARCH(" ",A1)+1)

   D1:  =LEFT(A1,B1-1)

   E1:  =IF(ISERROR(C1)," ",MID(A1,B1+1,C1-B1))

   F1:  =IF(ISERROR(C1),RIGHT(A1,LEN(A1)-B1),RIGHT(A1,LEN(A1)-C1))

1. The formula in cell B1 returns the position of the first space in the

   name.

2. The formula in cell C1 returns the position of the second space in

   the name, if one exists. Otherwise #VALUE! is returned.

3. The first name is placed in cell D1.

4. If a middle initial exists (that is, C1 does not have an error), it

   is placed in cell E1.

5. The last name is placed in cell F1.

Select cells B1:F2 and choose Fill Down from the Edit menu. Cells D1:F2

will look as follows:

   D1: Mary        E1: J.         F1: Smith

   D2: Joshua      E2:             F2: Johnston

This works well and easily if the customer doesn't want to use a

macro, or if the data doesn't parse easily. After parsing the data

this way, you will want to remove all the formulas by doing the

following:

1. Select cells D1:F2.

2. From the Edit menu, choose Copy.

3. From the Edit menu, choose Paste Special.

4. Select Values and choose OK.

5. Delete columns A through C.

REFERENCES

==========

"Function Reference," version 4.0, pages 248-253, 274-274, 373-374

"Function Reference," version 3.0, pages 135-138, 151-152, 208-209

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 5.00


Converting Hours in Decimal Form to HH:MM:SS Format in Excel

Article ID: Q72578

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0. 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

---------------------------------------------------------------------

SUMMARY

=======

If you want to convert hours displayed in decimal form so that they can be

displayed in a time format such as hh:mm:ss (for example, to convert 2.1 to

2:06:00), follow the procedure below appropriate for your version Microsoft

Excel.

MORE INFORMATION

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

Microsoft Excel versions 5.0 and later

--------------------------------------

1. Use the following formula to convert the number (n) to a serial number

      =n/24

   where n is any decimal number representing hours.

2. From the Format menu, choose Cells, and select the Number tab.

3. Under Category, select Time, and under Format Codes, select the desired

   number format.

Microsoft Excel versions 4.0 and earlier

----------------------------------------

1. Use the following formula to convert the number (n) to a serial number

      =n/24

   where n is any decimal number representing hours.

2. From the Format menu, choose Number, and select the desired number

   format (for example, select hh:mm:ss).

REFERENCES

==========

"User's Guide," version 5.0, pages 111, 209-218

"Function Reference," version 4.0, pages  433-434

"Function Reference," version 3.0, pages 236-237

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.00

4.0 4.00 5.00 4.00a


Excel: Optimizing Worksheets for Fastest Calculation

Article ID: Q72622

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

In Microsoft Excel, recalculation performance is affected by the way data

and formulas are arranged on the worksheet. The following list contains

tips for optimizing your worksheet to improve recalculation speed:

 - Organize your worksheets vertically. Use only one or two screens of

   columns, but as many rows as possible. A strict vertical scheme promotes

   a clearer flow of calculation.

 - When possible, a formula should refer only to the cells above it. As a

   result, your calculations should proceed strictly downward, from raw

   data at the top to final calculations at the bottom.

 - If your formulas require a large amount of raw data, you might want to

   move the data to a separate worksheet and link the data to the sheet

   containing the formulas.

 - Formulas should be as simple as possible to prevent any unnecessary

   calculations. If you use constants in a formula, calculate the constants

   before entering them into the formula, rather than having Microsoft

   Excel calculate them during each recalculation cycle.

 - Reduce, or eliminate, the use of data tables in your spreadsheet or set

   data table calculation to manual.

 - If you only need a few cells to be recalculated, replace the equal signs

   (=) of the cells you want to be recalculated. This is only an

   improvement if you are calculating a very small percentage of the

   formulas on your worksheet.

 - When a certain group of formulas must be recalculated a great number of

   times, then it may be helpful to replace the equal sign (=) in the

   formulas that you do not need to recalculate with a unique string that

   does not appear elsewhere. The formulas without the equal signs will not

   be recalculated (they are no longer considered formulas). When Microsoft

   Excel has recalculated the formulas that still contain equal signs,

   search for the unique string and restore the =.

 - Activate the Automatic Except Tables option. To do this, follow the

   appropriate procedure below for your version of Microsoft Excel:

   Microsoft Excel 5.0 and later

   -----------------------------

   1. From the Tools menu, choose Options, and select the Calculation tab.

   2. On the Calculation tab, select the Automatic Except Tables option.

   Microsoft Excel 4.x and earlier

   -------------------------------

   1. From the Options menu, choose Calculation.

   2. Select the Automatic Except For Tables option.

 - Do not use the Precision As Displayed option on the Calculation tab (the

   Calculation Options dialog box in Microsoft Excel 4.x and earlier). This

   option will slow recalculation because Microsoft Excel will have to

   round the numbers as it recalculates.

REFERENCES

==========

"User's Guide," version 5.0, pages 166-170

"User's Guide 1," version 4.0, pages 167-174

"User's Guide," version 3.0, pages 294-300, 697-700

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 3.00 4.00 4.00a 5.00 recalc calc


Converting a Decimal Degree Value to Degrees, Minutes, Seconds

Article ID: Q73023

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

This article provides a method to convert a degree value stored in

decimal format (base 10) to degrees, minutes, and seconds as text.

Microsoft Excel does not provide a number format to do this.

MORE INFORMATION

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

Fractions of a degree are commonly expressed in units called minutes

and seconds. One degree is equivalent to 60 minutes, and similarly one

minute equals 60 seconds. These units are most commonly used with

nautical charts and/or navigation.

The following function macro will accept an angle formatted as a

decimal number and convert it to degrees, minutes, and seconds as

text.

   A1:     Convert_Degree

   A2:     =ARGUMENT("Decimal_Deg")

   A3:     =RESULT(2)

   A4:     Degrees=INT(Decimal_Deg)

   A5:     Minutes=(Decimal_Deg-Degrees)*60

   A6:     Seconds=ROUND((Minutes-INT(Minutes))*60,0)

   A7:     =RETURN(Degrees&"~ "&INT(Minutes)&"' "&Seconds&"""")

For example, entering =Convert_Degree(10.46) into a worksheet returns

10~ 27' 36" (10 degrees, 27 minutes, 36 seconds).

REFERENCES

==========

"User's Guide," version 4.0, pages 210-211

"User's Guide," version 3.0, pages 574-75

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 4.0a 4.00a 5.00


Days360 Calculates as Designed in Excel

Article ID: Q73210

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh versions 3.x, 4.x, 5.0

----------------------------------------------------------------------

SUMMARY

=======

Microsoft Excel has a DAYS360 function, which is designed to calculate the

number of days between two specified dates based on a 360-day year, instead

of the normal 365-day year.

MORE INFORMATION

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

DAYS360 is based on twelve 30-day months and treats each month as such.

This is useful to help compute payments if your accounting system is based

on twelve 30-day months. So, when DAYS360 calculates the number of days

between 2/28/91 and 3/1/91 as 3, this is correct. DAYS360 assumes that

February has 30 days, not 28 (or 29 in a leap year). Likewise, DAYS360

treats the dates "1/30/91" and "1/31/91" identically. "1/31/91" is

converted to "1/30/91".

DAYS360 does conform to the standards established by the NASD

(National Association of Security Dealers), and the SIA standards

which specify that:

 - if the start date is the 31st of a month, it is equal to the 30th

   of the same month

 - if the end date is the 31st of a month, it is equal to the 1st of

   the next month

except when the start date is the 30th of a month.

The European method of this function is more simple. The 31st of a

month is always equal to the 30th of the same month.

DAYS360 calculates as designed and as described in the "Function

Reference".

REFERENCES

==========

Online Help, version 5.0

"Function Reference," version 4.0, 95-96

"Function Reference," version 3.0, page 46

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 5.0 5.00


Excel: Creating Gantt Charts

Article ID: Q73281

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

You can use Microsoft Excel to create Gantt Charts showing task status for

project planning and control. This article gives an example and shows the

steps necessary to generate the charts.

Example

-------

1. Open a new worksheet in Microsoft Excel and enter the following

   values:

      A1:             B1: START       C1: DAYS        D1: DAYS

      A2: TASK        B2: DATE        C2: COMPLETED   D2: REMAINING

      A3: TASK-1      B3: 1/1/91      C3: 150         D3: 15

      A4: TASK-2      B4: 5/1/91      C4: 21          D4: 31

      A5: TASK-3      B5: 7/1/91      C5: 0           D5: 114

      A6: TASK-4      B6: 10/1/91     C6: 0           D6: 4

      A7: TASK-5      B7: 10/15/91    C7: 0           D7: 31

      A8: TASK-6      B8: 11/1/91     C8: 0           D8: 2

2. Select cell B2 and format with the month/day/year format you want

   to use for the chart.

3. For versions 2.x, 3.0, and 4.0 only:

   Highlight A2:D8 and press F11 to create a chart.

   For version 5.0 only:

   Highlight A2:D8 and from the Insert menu select Chart - As New Sheet.

   (This starts the Chart Wizard.)

     In step 1: choose Next

        step 2: choose Bar

        step 3: choose Bar chart #3,

        step 4: change First Column for Category X-Axis labels to "1",

        step 5: Finish.

4. For versions 2.x, 3.0, and 4.0 only:

   From the Gallery menu, choose Bar and select type number 3. Bar chart 3

   should be a stacked Bar chart.

5. For versions 2.x, 3.0, and 4.0 only:

   The first data series in a chart is usually red. Select this series

   and choose Patterns from the Format menu. Set the patterns for both

   the border and area to None.

   For version 5.0 only:

   The first data series is usually blue. Select the first series and

   from the Format menu choose Selected Data Series (or double-click on

   the first series). Choose the Patterns Tab and set both the Border

   and Area to none.

6. For versions 2.x, 3.0, and 4.0 only:

   Select the Y-axis (horizontal axis) and choose Scale from the

   Format menu.

   For version 5.0: From the Format menu choose Selected Axis then select

   the Scale tab.

   If you are using Microsoft Excel for Windows or OS/2, set the minimum

   to 33200, maximum to 33600, major step to 31, and minor step to 1. If

   you are using Microsoft Excel for the Macintosh, set the minimum to

   31777, maximum to 32120, major step to 31, and minor step to 1. The

   minimum and maximum numbers represent serial numbers for dates. The

   minimum serial number should be a date somewhat near the minimum date

   in column B of the original data.

Note that in a bar chart the traditional X- and Y-axes are reversed;

the X-axis is vertical and the Y-axis is horizontal.

7. For versions 2.x, 3.0, and 4.0 only:

   Select the X-axis (vertical axis) and choose Scale from the Format

   menu.

   For version 5.0: Select the X-axis and choose the Selected Axis from the

   Format menu. Select the Scale tab.

   Verify that the Value Y-Axis Crosses Between Categories

   check box is NOT selected and that the Categories in Reverse Order

   check box is selected.

8. For versions 2.x, 3.0, and 4.0 only:

   From the Chart menu, choose Gridlines and verify that the Major

   Gridlines check box is selected for the Y-axis.

   For version 5.0 only:

   From the Insert menu choose Gridlines and verify that the Major

   Gridlines check box is selected for the Y-axis.

The Gantt Chart should now be displayed on the screen. Additional

formatting can be added as needed.

REFERENCES

==========

"User's Guide," version 5.0, chapters 15, 17, 18

"User's Guide 1," version 4.0, chapter 14

"User's Guide 2," version 4.0, chapter 7

"User's Guide," version 3.0, chapters 13 and 19

"PC Magazine," Feb 26,1991, "Spreadsheets," page 410, Craig Stinson

KBCategory: kbusage

KBSubcategory: kbprb

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00 Gant Gannt


Using INDEX() to Automatically Update Range in SUM() Formula

Article ID: Q73586

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

In Microsoft Excel, a range referenced in a SUM() function (or any

function) does not automatically expand to include newly added rows or

columns. This situation is true regardless of whether the formula

references a range, as in the formula =SUM(A1:E1), or a defined name,

as in the formula =SUM(NamedRange).

If you want to reference a range so that it is automatically updated

when you add new rows or columns, you can use the INDEX() and SUM()

functions in a formula similar to the following :

   =SUM(first_cell:INDEX(column:column,ROW()-1))

In this formula, <first_cell> is the address of the first cell of the

range to be summed and <column> is the letter identifying the column

of the summed range.

Because the INDEX() function always returns the address of the cell

immediately preceding the cell containing the SUM() formula, there is

no need to edit the formula when you insert new rows.

If your data is arranged horizontally instead of vertically, use the

following formula:

   =SUM(first_cell:INDEX(row:row,COLUMN()-1))

Note that in the above formula the only difference from the previous

one is that column:column is changed to row:row, and ROW() is changed

to COLUMN().

The above formulas are useful in situations where want to keep a

running total of information.

Example

-------

1. In a new worksheet, type the following:

   A1:  Months             B1: Amounts

   A2:  May                B2: 50

   A3:  June               B3: 50

   A4:  July               B4: 50

   A5:                     B5:

2. To create a formula such that you can keep a running total of this

   information, type the following:

   A6:  Total              B6: =SUM(B2:INDEX(B:B,ROW()-1))

Explanation of Formula in B6

----------------------------

 - The ROW() function returns the row number of the active cell (in

   this case, B6).

 - INDEX(B:B,ROW()-1) returns the cell immediately preceding the

   active cell (in this case, B5).

 - The entire function is converted to =SUM(B2:B5).

REFERENCES

==========

In Microsoft Excel version 5.0, the equivalent of the "Function Reference"

is contained in the Online Help. To access this information, press the F1

key (or select Contents from the Help menu), then choose Reference

Information. You should now see Late Breaking Information about Excel and

General Reference. Under General Reference, select Worksheet Functions and

scroll through the Alphabetical List of Worksheet Functions.

"Function Reference," version 4.0, pages 238, 423

"Function Reference," version 3.0, pages 127, 231

"Functions and Macros," version 2.0 for Windows and OS/2, pages 60,

112

"The Expert," Volume 4, Number 6, June 1991

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.2 2.20 2.21 3.0 3.00 4.00 4.00a 5.00


Excel: Dates Assume Twentieth Century in Microsoft Excel

Article ID: Q73673

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

----------------------------------------------------------------------

SUMMARY

=======

If you enter a date in Microsoft Excel, but you do not specify the century

in which the date occurs, Microsoft Excel may assume that the date occurs

in the twentieth century (1900s).

You can create a macro to change 20th century dates to 21st century dates.

NOTE: The latest date that Microsoft Excel will accept is December 31,

2078.

MORE INFORMATION

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

In Microsoft Excel version 2.1, the twentieth century is always assumed,

but in Microsoft Excel versions 3.0 later, it is only assumed if the year

portion of the date is greater than 19 (for example, 1/1/20).

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

This procedure takes a 20th century date and adds to the year, so the year

is converted to 21st century.

CAUTION: This procedure will remove the old date and overwrite it with the

new date.

Visual Basic Procedure

----------------------

1. In a Visual Basic module, enter the following code:

   Sub CenturyConvert()

   'Run the following subroutine until you reach a blank cell.

   While Not (ActiveCell = "")

      'Place the contents of the active cell into the variable ac

      ac = ActiveCell

      'Ignore if the year is '79 or later because Microsoft Excel

      'cannot handle dates later than 1/31/2078.

      If Right(CStr(Year(ac)), 2) < 79 Then

         'Add 2000 to the year, rebuild the date and let temp hold

         'the date.

         temp = DateValue(DateSerial(2000 + (Year(ac) Mod 100), _

         Month(ac), Day(ac)))

         'Return the 21st century date to the new cell on the worksheet.

         ActiveCell.Value = CDbl(temp)

         'Finish Ignore loop.

      Else

      End If

   'Move down to the next cell.

   ActiveCell.Offset(1, 0).Select

   Wend

   End Sub

2. To run the above code, select the first cell in the column containing

   the dates, choose Macro from the Tools menu, select the CenturyConvert

   macro, and choose Run.

Microsoft Excel Version 4.0 Macro

---------------------------------

In Microsoft Excel, you can use the DATE function for dates with years from

1900 to 2078. The following macro converts each date in a column to the

21st century, as long as the year portion of the date is less than 79,

regardless of which century is currently defined for each:

   A1:  =WHILE(NOT(ISBLANK(ACTIVE.CELL())))

   A2:  AC=ACTIVE.CELL()

   A3:  =FORMULA(DATE(2000+MOD(YEAR(AC),100),MONTH(AC),DAY(AC)))

   A4:  =SELECT("R[1]C")

   A5:  =NEXT()

   A6:  =RETURN()

Before you run this macro, select the cell at the top of a column of

dates. The macro stops at the first blank cell in the column.

Use the following formula to convert a date in a specific cell (replace A1

with the appropriate cell reference):

   =DATE(2000+MOD(YEAR(A1),100),MONTH(A1),DAY(A1))

Format the cell containing the above formula to an appropriate date format.

Again, the year portion of the date must be less than 79, or you will

receive the #NUM! error value.

REFERENCES

==========

"User's Guide," version 4.0, pages 93-94

"Microsoft Excel User's Guide," for Windows and OS/2, version 3.0,

pages 93-96

"Microsoft Excel Reference Guide," for Windows and OS/2, version 2.x,

pages 188-190

KBCategory: kbprg kbcode kbmacro

KBSubcategory:

Additional reference words: 7.00 3.00 4.00 4.00a 5.00


Excel: Changing the Default Directory

Article ID: Q74342

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, there are various methods to change the default

directory in which Microsoft Excel starts. Microsoft Excel will normally

start up with the directory to which you installed Microsoft Excel as the

active directory, but you may want to change this default to a specified

directory. You can check the current default directory by choosing Open

from the File menu after starting the Microsoft Excel program. The current

directory is listed after "Directory is..."

Microsoft Excel Version 3.0

---------------------------

Modify Program Icon Properties:

1. Verify that the directory containing EXCEL.EXE is in the path

   statement of your AUTOEXEC.BAT file.

2. From the Program Manager, select the Microsoft Excel icon and

   choose Properties from the File menu.

3. Type the path of the desired directory in the Command Line text box,

   followed by "\excel.exe" (without the quotation marks).

   For example, type the following:

      c:\user\excel.exe

4. The error message "The specified path is invalid" will appear.

   Choose OK to bypass this message.

Microsoft Excel will now start with the specified directory as the default

drive and directory. This method changes the icon from the standard

Microsoft Excel icon to a MS-DOS icon. To correct this, do the following:

1. Select the icon once again in the Program Manager. From the File

   menu, choose Properties.

2. Choose the Change Icon button.

3. Type the correct path for the EXCEL.EXE file (for example,

   c:\excel\excel.exe) and press the ENTER key.

You will see the message "The specified path is invalid" once again.

However, you can ignore it at this point and everything will still

work properly.

If you are using Windows 3.1, you can change the Working Directory from

within Program Manager. From the File menu, choose Properties and type the

path in the Working Directory field box.

Microsoft Excel Versions 3.0 and 4.0 Only

-----------------------------------------

Create An Add-In:

   A1: DEFAULT_DIR

   A2: =DIRECTORY("C:\USER")

   A3: =RETURN()

1. Enter the above macro into a macro sheet. Select cell A1. Define

   this macro as an Auto_Open macro by choosing Define Name from the

   Formula menu, entering "auto_open" (without the quotation marks)

   in the Name box, and selecting the Command button. Choose OK.

2. Save the macro as an add-in macro in the XLSTART directory by

   choosing Save As from the File menu, choosing Options, and

   selecting Add-In from the list. Choose OK. For the filename, enter

   the path to the XLSTART directory, followed by the filename (for

   example, c:\excel\xlstart\defltdir.xla).

Documents that are saved in the XLSTART directory are automatically opened

when the Microsoft Excel program is started. Because this macro sheet is

saved as an add-in macro, it will open as hidden. You are unable to view

it, even by choosing the Window Unhide command. However, the macro will run

because it has been saved as an Auto_Open macro.

Microsoft Excel Versions 2.x, 3.x, and 4.x

------------------------------------------

Create an Auto_Open Macro:

1. Open a new macro sheet. Choose Save As from the File menu and enter

   "c:\changedi.xlm" (or any valid path and filename, without the

   quotation marks) in the File Name box. Choose OK.

2. Enter the following macro into the macro sheet:

      A1: Auto_Open

      A2: =DIRECTORY("C:\USER")

      A3: =NEW()

      A4: =RETURN()

   The =DIRECTORY statement will set the current drive to the path

   described in the pathname. The =NEW command will open up a blank

   worksheet.

3. Define the macro as an Auto_Open macro by doing the following:

   a. Select cell A1.

   b. From the Formula menu, choose Define Name.

   c. Choose the Command button.

   d. Choose OK.

4. In Notepad (or another text editor), open the EXCEL.INI file (version

   3.0) or the EXCEL4.INI file (version 4.0). This file is located in the

   WINDOWS directory. Scroll down to the [Microsoft Excel] heading and add

   the following line below the heading:

      open=c:\changedr.xlm

This causes CHANGEDR.XLM to open every time Microsoft Excel is started.

Use /p Startup Switch:

You can specify a default working directory by using the "/p" startup

switch. For more information, refer to the "User's Guide."

Microsoft Excel Version 4.x Only

--------------------------------

You can add an OPEN= statement in the [Microsoft Excel] section of your

EXCEL4.INI file and use the /p option. This option specifies a directory to

be used as the default directory from which documents are opened and to

which documents are saved. Enter this option to the right of the equal sign

in the OPEN= statement.

Microsoft Excel Version 4.0a Only

---------------------------------

You can add the line "OpenDir=<path>" to the EXCEL4.INI to set the working

directory. This option overrides the icon properties working directory

information and command line switches.

Microsoft Excel Version 5.0

---------------------------

For information about changing the working directory in Microsoft Excel

version 5.0, please see the following article in the Microsoft Knowledge

Base:

   ARTICLE-ID: Q110209

   TITLE     : XL5: Hierarchy of Methods to Change the Working Directory

Microsoft Excel Version 7.0

---------------------------

For information about setting the default file location in Microsoft Excel

version 7.0, please see the following article in the Microsoft Knowledge

Base:

   ARTICLE-ID: Q135474

   TITLE     : XL7: Starting Microsoft Excel with a Different Working

               Folder

REFERENCES

==========

"Microsoft Windows User's Guide," version 3.1, pages 79-81

"Microsoft Windows User's Guide," version 3.0, pages 89-91

"Microsoft Excel User's Guide 1," version 4.0, pages 79-80, 292

"Microsoft Excel User's Guide," version 3.0, pages 553, 651

"Microsoft Excel Reference Guide," version 2.1, pages 209-211

"Microsoft Excel Functions and Macros," version 2.1, pages 270, 353

KBCategory: kbusage

KBSubcategory: xlwin

Additional reference words: 2.00 2.01 2.10 2.20 2.21 3.00 4.00 4.00a


Excel: Methods to Automatically Add Zeros After a Number

Article ID: Q74523

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0

 - Microsoft Excel for OS/2, versions 2.2, 2.21, 3.0

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

There are two ways to automatically add zeros after a number in a

worksheet. Both methods are described below.

MORE INFORMATION

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

These methods only work for integers. Real numbers with significant digits

to the right of the decimal will not be affected.

Method 1: To add zeros after the number, without changing the value of the

          entered number, use the following steps:

          1. In cell A1, enter a number such as "45" (without the quotation

             marks).

          2. With cell A1 active, on the Format menu, click Cells, and

             click the Number tab. (In Microsoft Excel versions 4.0a and

             earlier, click Number on the Format menu.)

          3. Under category, click Custom, and create the following custom

             number format ##",000,000".

          This format will display the number 45 as "45,000,000" in cell

          A1. Note that the value of the number is still 45.

Method 2: To add the zeros and change the value of the entered number:

          1. On the Tools menu, click Options, and click the Edit tab. (In

             Microsoft Excel versions 4.0a and earlier, click Workspace on

             the Options menu.)

          2. Select the Fixed Decimal check box (place a check mark in it).

             In the Places field, enter "-6" (without the quotation marks),

             and click OK.

          3. In cell A2, type a number such as "45" (without the quotation

             marks).

          This procedure will display the number 45 as 45000000 in cell A2.

          The value of the number is 45000000.

For more information about the fixed decimal feature, click the Index tab

in Microsoft Excel version 7.0 Help, type the following text

   fixed decimals

click the "Type numbers with fixed decimal places" topic, and then click

Display.

REFERENCES

==========

"Microsoft Excel User's Guide, Book 1" version 4.0, page 220

"Microsoft Excel User's Guide, Book 2" version 4.0, page 191

"Microsoft Excel User's Guide" version 3.0, pages 188 and 551

"Microsoft Excel Reference Guide" version 2.1, pages 321-326 and 584

KBCategory: kbusage

KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 5.00 5.00c 7.00 howto spreadsheet


Maximum Array Size in Microsoft Excel

Article ID: Q75376

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel versions later than 3.0, the maximum size of an array is

64k, or approximately 6550 elements.

In Microsoft Excel versions later than 3.0, the maximum size of an array is

64k. In Microsoft Excel version 7.0 (32 bit application), this is 5458

elements. In Microsoft Excel versions 3.0, 4.0, and 5.0 (16 bit

applications), this is approximately 6550 elements.

In versions of Microsoft Excel prior to version 3.0, the maximum size of

any array is 16k, or approximately 1632 elements.

MORE INFORMATION

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

Page 166 of the "Microsoft Excel User's Guide 1," version 4.0 and page 288

of the "Microsoft Excel User's Guide" for version 3.0 state that Microsoft

Excel allows arrays of up to approximately 6,500 elements. In addition, the

"Features and Specifications" section in Appendix A of the "Microsoft Excel

User's Guide" does not include the array size limit. The Microsoft Excel

Online Help incorrectly states the limit as 1636.

If you attempt to create an array on a worksheet using a greater number of

cells than the number of elements allowed for that version of Microsoft

Excel (6550 in versions 3.x, 4.x, 5.0), you receive the following error

message:

   Selection is too large

When you use an array that contains greater than the maximum number of

elements in a function, the function returns the "#NUM!" error value. The

following is a list of some of the functions that use an array as an

argument:

   SUM(IF()), MINVERSE(), MDETERM(), MMULT(), TRANSPOSE(), LINEST(),

   TREND()

MINVERSE() is the apparent exception to this rule. In Microsoft Excel

version 4.0, MINVERSE only allows an array size of 3249 elements (57 Rows

by 57 Columns). If this maximum array size is exceeded, the function

returns the #VALUE! error value.

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q132221

   TITLE     : XL7: Array Formulas Return #NUM! Error Value

REFERENCES

==========

"User's Guide," version 5.0, page 171

"User's Guide 1," version 4.0, page 166

"User's Guide," version 3.0, page 288

KBCategory: kbother kbfasttip

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.00

4.00 4.00a 5.00 5.00a 5.00c publish subscribe matrix matrices limit err msg


Recovering Data from a Damaged Excel File

Article ID: Q75818

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for the Macintosh, versions 1.x, 2.x, 3.x, 4.x, 5.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can extract the values from a damaged file by

using external references to link to the desired file. The file

structure must be complete, otherwise Microsoft Excel cannot read the

information.

MORE INFORMATION

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

WORKAROUND #1

-------------

1. Change the active directory to the directory that contains

   the damaged file.

2. Open a new worksheet (workbook in version 5.0). From the File menu,

   choose New, then select Worksheet.

3. Type =SHEET.XLS!A1 in cell A1 on the new worksheet, where SHEET.XLS

   is the name of the damaged sheet. A prompt appears and asks which

   sheet within the workbook you want to link to.

4. Select an area that approximates the width of the damaged file.

   Select A1:H1 for example, then choose Fill Right from the Edit menu.

5. Select the number of rows in the damaged file, A1:H100 for example,

   then choose Fill Down from the Edit menu.

6. While the cells are still selected, choose Copy from the Edit menu.

7. Choose Paste Special from the Edit menu. Select Values and choose OK.

   This destroys the links to the damaged file leaving the data.

WORKAROUND #2

-------------

The following is one method of linking to the file:

1. Open two new worksheets.

2. In the first sheet, select a range of cells (for example, A1:D10).

3. From the Edit menu, choose Copy.

4. Activate the second sheet and choose Paste Link from the Edit Menu.

5. From the File menu, choose Links.

6. Select the filename of the first sheet and choose Change. A prompt

   appears and asks which sheet within the workbook you want to link to.

Microsoft Excel asks you to locate the file to which you want to link.

After you select and open the file, Microsoft Excel will retrieve any

available cell values.

This procedure will create an array formula. To be able to change a

cell that is part of an array, either the whole array needs to be

changed or the array definition needs to be changed so that it will

not include that cell.

To change the size of the array, do the following:

1. Highlight the range of cells containing the link formula.

2. Press F2 to active the formula bar.

3. Press and hold the CONTROL key in Microsoft Excel for Windows

   (COMMAND key in Microsoft Excel for the Macintosh) and press

   the ENTER key to turn off the array formula.

4. Highlight a range on your worksheet large enough to accommodate

   the cells on the damaged worksheet. This range should include the

   range of cells originally used to create the link.

5. Press F2 to activate the formula bar again.

6. Change the cell range specified in the link formula to match the

   range of data in the damaged worksheet.

7. Press CONTROL+SHIFT+ENTER in Microsoft Excel for Windows or

   COMMAND+ENTER in Microsoft Excel for the Macintosh to reactivate

   the array formula.

After you press CONTROL+SHIFT+ENTER (or COMMAND+ENTER), your worksheet

will begin to update with the information from your damaged worksheet.

To remove an array formula from a range after it has been used to link

information from another spreadsheet, do the following:

1. Select the entire array.

2. From the Edit menu, choose Copy.

3. While the array is still selected, choose Paste Special from the

   Edit menu.

4. Specify Values and choose OK.

REFERENCES

==========

"Microsoft Excel User's Guide 1," version 4.0, pages 157-158, 365-371

"Microsoft Excel User's Guide 2," version 4.0, pages 126-132

"Microsoft Excel User's Guide," version 3.0, pages 280-282, 307-316

KBCategory: kbusage

KBSubcategory: kberrmsg

Additional reference words: 7.00 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.0

2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 3.00 4.0 4.00 5.0 5.00

corrupted recover link workbook


Converting Text to Numbers in Excel

Article ID: Q75945

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you import a file in Microsoft Excel that has been created in another

program (such as dBASE or Lotus 1-2-3) or that has been downloaded from a

mainframe, Microsoft Excel may recognize some numbers as text. This will

cause functions such as SUM() and AVERAGE() to ignore the values in these

cells. These text strings may contain actual text in addition to the

numbers you want to convert.

MORE INFORMATION

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

Consider the following example:

   A1: ='123

   A2: ='234

   A3: ='345

   A4: ='456

   A5: ='567

To convert these text strings to numbers, do the following:

Method 1

--------

1. In cell B1, enter the value 1. Select the cell B1, and choose Copy from

   the Edit menu.

2. Select cells A1:A5. From the Edit menu, choose Paste Special. Select the

   Multiply option, and choose OK.

3. With cells A1:A5 still selected, choose Copy from the Edit menu.

4. With cells A1:A5 still selected, choose Paste Special from the Edit

   menu. Under Paste, select the Values option, and choose OK.

Method 2

--------

The second technique works best if the data is arranged in a single

column or row. The following example assumes that the data is in

column A:

1. Insert a column to the right of column A by selecting column B and

   choosing Columns from the Insert menu (version 5.0) or choose Insert

   from the Edit Menu (earlier versions).

2. In the first cell of the inserted column (B1), enter the formula

   "=VALUE(A1)" (without the quotation marks).

3. In column B, select all the cells to the right of the cells

   containing data in column A.

4. From the Edit menu, choose Fill, and then choose Down (version 5.0) or

   from the Edit menu, choose Fill Down (versions earlier than 5.0).

   The new column now contains the values of the text in column A.

5. With the same range selected, choose Copy from the Edit menu.

6. Select cell A1, and choose Paste Special from the Edit menu. Under

   Paste, select the Values option, and choose OK to paste the converted

   values back on top of column A.

7. Delete column B by selecting the column and choosing Delete from

   the Edit menu.

The text that was in column A is now in number format.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, page 444.

"Microsoft Excel User's Guide, Book 1," version 4.0, page 188-197.

"Microsoft Excel Function Reference," version 3.0, page 243.

"Microsoft Excel User's Guide," version 3.0, pages 156-165.

"Microsoft Excel Functions and Macros," versions 2.x, pages 122-123.

"Microsoft Excel Reference Guide," versions 2.x, pages 236-237.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 5.00


Consolidate Function Doesn't Create Links to Blank Cells

Article ID: Q76181

-----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

-----------------------------------------------------------------------

SUMMARY

=======

The Consolidate function in Microsoft Excel will not create links to

blank cells on your source worksheets when you choose Consolidate from

the Data menu and select the Create Links To Source Data check box.

MORE INFORMATION

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

If your source worksheet contains blank cells within the range of cells

that you want to consolidate, those cells are not included in the

consolidation worksheet. Microsoft Excel treats the blank cells in your

consolidation range just as it does text, and therefore does not create

a link to them.

Workaround

----------

Because Microsoft Excel looks for numeric data to consolidate, it is

essential that you initialize each cell which you want to be included

in the consolidation with some numeric value. Placing a zero in each

of these cells works well.

REFERENCES

==========

"Microsoft Excel User's Guide 1," version 4.0, pages 374-383

"Microsoft Excel User's Guide," version 3.0, pages 328-334

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 3.0 3.00 4.0 4.00


PMT Argument Not Required with FV, NPER, PV, and RATE Function

Article ID: Q76358

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

FV, NPER, PV, and RATE are four of Microsoft Excel's financial functions.

The "Microsoft Excel Function Reference" shows that PMT is a required

argument for each of these functions. This is a documentation error. The

PMT function can be omitted with each of these functions.

MORE INFORMATION

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

In the headings or syntax lines in the Function Reference Manuals,

required arguments are italic and bold and optional arguments are

italic but not bold. Because the PMT argument is in bold italics,

it is assumed to be required; however, these functions will return

valid results with no PMT argument included.

Example

-------

The form of the RATE function is:

   RATE(nper,pmt,pv,fv,type,guess)

In the Function Reference, fv, type, and guess are shown in

italics, but not bold, which identifies them as optional.

If you deposit $1000.00 in the bank today and it will be worth

$1500.00 in 36 months, and your goal is to determine the monthly

interest rate, you can use the RATE function as follows:

   =RATE(36,,-1000,1500)

This returns a monthly interest rate of 1.1%.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, page 347.

"Microsoft Excel Function Reference," version 3.0, page 192.

"Microsoft Excel Functions and Macros," version 2.x, pages 21, 102, 337

KBCategory: kbdocerr

KBSubcategory:

Additional reference words: 5.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 7.00


XL: Creating a Two-Dimensional Lookup Table in Microsoft Excel

Article ID: Q76428

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0

 - Microsoft Excel for OS/2, versions 2.2, 2.21, 3.0

 - Microsoft Excel for the Macintosh version 2.x, 3.0, 4.0, 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

A two-dimensional lookup table is one in which the desired value depends on

two different variables. The following formula finds a value in a table,

based on two lookup values:

   =INDEX(Data_Table,MATCH(Row_Val,Row_Headers),MATCH(Col_Val,Col_Headers))

This formula works well in cases where using the Intersection operator

(space) will not work (for example, when lookup values are numbers or

do not match row and/or column headings exactly).

MORE INFORMATION

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

   This variable  Should be substituted with this range or value

   -------------------------------------------------------------

   Data_Table     The range containing the entire source table,

                  including column and row headers.

   Row_Val        The value to look up in the row headers.

   Row_Headers    The row headers; this should be the left column of

                  Data_Table.

   Col_Val        The value to look up in the column headers.

   Col_Headers    The column headers; this should be the top row of

                  Data_Table.

NOTE: Both column and row headers must be sorted in ascending order to use

this formula. Note also that either the column or row headers can specify a

range of values, rather than a single value. However, to specify a range,

the header must use the minimum number in that column (for example, the

header for a column that specifies the range 137-142 should be 137).

Example

-------

The following is a two-dimensional table that displays the cost per

unit of several products. The cost per unit varies, depending on the

number of items ordered. Column A contains the Product Name. Row 1

contains the minimum number of items that must be purchased to obtain

the purchase price in that particular column:

   A1:             B1: 1           C1: 10          D1: 100

   A2: MS Excel    B2: $395        C2: $350        D2: $300

   A3: Mouse       B3: $99         C3: $89         D3: $79

   A4: MS Project  B4: $695        C4: $610        D4: $500

   A5: Word        B5: $495        C5: $425        D5: $350

Assume you want to find the unit price if you purchase 15 units of

MS Project. If you enter "MS Project" (without the quotation marks) into

cell A7 and the number 15 in cell A8, you can return the unit price by

entering the following formula:

   =INDEX(A1:D5,MATCH(A7,A1:A5),MATCH(A8,A1:D1))

This formula returns $610.

Example 2

---------

To use the values in A8 and B8 to indicate the two values to be

cross-referenced on the table

    A1:     B1:  1   C1:  2    D1:  3   E1:  4   F1:  5

    A2: 1   B2:  1   C2:  2    D2:  3   E2:  4   F2:  5

    A3: 2   B3:  2   C3:  4    D3:  6   E3:  8   F3: 10

    A4: 3   B4:  3   C4:  6    D4:  9   E4: 12   F4: 15

    A5: 4   B5:  4   C5:  8    D5: 12   E5: 16   F5: 20

    A6: 5   B6:  5   C6: 10    D6: 15   E6: 20   F6: 25

    A7:     B7:      C7:       D7:      E7:      F7:

    A8: 4   B8:  5   C8:       D8:      E8:      F8:

use the following formula:

   =INDEX(B2:F6,MATCH(A8,B1:F1,0),MATCH(B8,A2:A6,0))

The result of this formula is 20.

If you want to look for the largest value less than or equal to the values

searched for (useful for a commission table, tax table, and so on), change

the zeros in the MATCH functions to ones.

REFERENCES

==========

For more information about the MATCH() and INDEX() functions, click the

Index tab in Microsoft Excel version 7.0 Help, type the following text

   lookup functions

click Display, and then double-click the "Lookup & Reference Functions"

topic to go to that topic.

"Function Reference," version 4.0, pages 236-237, 267

"Microsoft Excel Function Reference," version 3.0, pages 127-128, 148

KBCategory: kbusage

KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 3.00

4.0 4.00 5.00 7.00 Cross-Reference multiplication table commission sheet


Macro to Add Data Point Labels to a Chart in Excel

Article ID: Q77086

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can place text labels on individual data points in

a chart. You can replace existing labels or create new labels with text

values from a worksheet either by manually editing the label in the formula

bar in the chart, or you can write a macro. This article shows how to do

this from a macro, which is the desired method if the chart contains many

data points or if you update charts in this fashion often.

MORE INFORMATION

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

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided 'as is' and Microsoft does not guarantee that the

following code can be used in all situations. Microsoft does not support

modifications of the code to suit customer requirements for a particular

purpose.

Example

-------

The following example creates new, or replaces existing, data labels on a

chart for a single data series. Before following the steps below, you

should have an existing chart, and you should have a range of cells on your

worksheet containing the labels that you wish to have placed in your chart.

The number of labels on your worksheet should be equal to the number of

points per data series in your chart.

1. Select the cells containing the labels in your worksheet. (For this

   example, the worksheet will be called "SHEET1.XLS".)

2. From the Formula menu, choose Define Name. Type "Labels" (without

   the quotation marks) in the Name box and choose the OK button.

3. Enter the following into a macro sheet:

      A1: i=1

      A2: =FOR.CELL("CurrentCell",Sheet1.XLS!Labels)

      A3: =ATTACH.TEXT(4,1,i)

      A4: =FORMULA(CurrentCell)

      A5: i=i+1

      A6: =NEXT()

      A7: =RETURN()

   This macro uses a FOR.CELL loop. Each pass through the loop takes

   the text from the current cell in the range called "Labels" and

   places that text on the next data point. Incrementing the counter

   "i" allows the ATTACH.TEXT statement to refer to the next data

   point.

4. Select cell A1. From the Formula menu, choose Define Name. Type

   "Change" (without the quotation marks) in the Name box. Choose

   Command and choose the OK button.

5. Activate your chart and run the macro by choosing Run from the

   Macro menu, selecting Change from the list box, and then choosing

   the OK button.

If your chart has more than one data series, you will need to make

modifications to this macro.

NOTE: This works differently under 3-D charts.

REFERENCES

==========

"User's Guide 1," version 4.0, pages 455-456

"Function Reference," version 4.0, pages 29-30, 155-156

"Microsoft Excel User's Guide" for Windows, version 3.0, pages

475-476

"Microsoft Excel Function Reference" for Windows, version 3.0, pages

18-19, 80

KBCategory: kbprg kbmacro

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 data marker 5.00


Performing a Lookup with Unsorted Data in Excel

Article ID: Q77114

------------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x

 - Microsoft Excel for OS/2, versions 2.2, 2.21, 3.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.0

------------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the VLOOKUP function searches the leftmost column of an

array for a particular value and returns the corresponding value from a

cell in another column, indicated by the col_index_num.

VLOOKUP requires that the first column of the lookup table is sorted in

ascending order. The following information describes different formulas

that you can use to return the same information returned by VLOOKUP()

without requiring that the first column of the table be sorted.

MORE INFORMATION

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

Using INDEX() and MATCH()

-------------------------

The following formula return the same information that a VLOOKUP returns

without requiring the first column of the table to be sorted:

   =INDEX(Table_Array,MATCH(Lookup_Value,Lookup_Array,0),Col_Index_Num)

where:

   Table_Array    = The entire lookup table

   Lookup_Value   = the value to be found in the first column of

                    "table_array"

   Lookup_Array   = the range of cells containing possible

                    lookup values

   Col_Index_Num  = the column number in "table_array" for which

                    the matching value should be returned

If none of the cells in Lookup_Array match Lookup_Value, this formula

will return #N/A.

Using OFFSET() and MATCH()

--------------------------

The OFFSET function can be used if you are unsure of the entire address of

"table_array" because it uses the MATCH function to locate the position of

"lookup_value" within "lookup_array." In the following function, the

"offset_col" argument uses the upper left most cell of the table as

"top_cell" and returns the desired value as determined by the MATCH (offset

row) and offset column.

   =OFFSET("top_cell",MATCH("lookup_value","lookup_array",0),"offset_col")

Example

-------

   A1: Name        B1: Dept        C1: Age

   A2: Henry       B2: 501         C2: 28

   A3: Stan        B3: 201         C3: 19

   A4: Mary        B4: 101         C4: 22

   A5: Larry       B5: 301         C5: 29

Because the "Name" range is not sorted, using VLOOKUP to find the age of

Mary returns 28, the age of Henry. To find the age of Mary, use the

following:

   =OFFSET(A1,MATCH("Mary",A2:A5,0),2)

The function returns 22.

NOTE: In Microsoft Excel version 5.0, the first column of your lookup table

does not have to be sorted to use the VLOOKUP and HLOOKUP functions. The

OFFSET function described above also works in Microsoft Excel version 5.0,

but is not necessary.

For additional information about using the VLOOKUP function to find an

exact match in Microsoft Excel version 5.0, please see the following

article in the Microsoft Knowledge Base:

   ARTICLE ID: Q108639

   TITLE     : XL5: Range_Lookup Argument in VLOOKUP() Finds Exact Match

REFERENCES

==========

"Function Reference," version 4.0, pages 267-268, 299-300

"Function Reference," version 3.0, pages 148-149, 163-164

"Functions and Macros," version 2.1, pages 78, 320

KBCategory: kbusage

KBSubcategory:

Additional reference words: 2.00 2.01 2.10 2.20 2.21 3.00 4.00 hlookup

exact


Starting Excel with No Worksheets Open

Article ID: Q77538

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, version 3.0, to start the program with no

worksheets open, you can create an Auto_Open macro that closes Sheet1.

Normally an Auto_Open macro will run before Sheet1 ever opens, so you

must end the Auto_Open macro, allow Sheet1 to open, and then run a

second macro that closes Sheet1. If you are using Microsoft Excel

version 4.0, you may use the /e startup switch as an alternative to

this macro.

MORE INFORMATION

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

The following Auto_Open macro uses the ON.TIME function to call a

second macro two seconds later. This gives Sheet1 time to open before

the second macro is executed. The second macro then closes Sheet1 and

displays the Null menu bar (File and Help menus only).

1. Enter the following into a macro sheet:

      A1: Auto_Open

      A2: =ON.TIME(NOW()+"00:00:02","SHUTDOWN")

      A3: =RETURN()

      A4: ShutDown

      A5: =ACTIVATE("Sheet1")

      A6: =CLOSE()

      A7: =RETURN()

2. Select cell A1. Choose Define Name from the Formula menu. Select

   the Command option and choose OK.

3. Select cell A4 and repeat Step 2 above.

4. Save this macro sheet as an add-in macro in the EXCEL\XLSTART

   subdirectory. To save it as an add-in macro, choose Save As from

   the File menu, choose Options, and select Add-In from the File

   Format list.

This macro will result in an error if it is not saved as an add-in

macro.

For additional information on the /e startup switch, see page 7 in the

"Microsoft Excel User's Guide 1," version 4.0 or query in the

Microsoft Knowledge Base using the following words:

   startup and switches and command-line.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, pages 305-306

"Microsoft Excel User's Guide 1," version 4.0, pages 7 and 60-61

"Microsoft Excel User's Guide 2," version 4.0, page 260

"Microsoft Excel Function Reference," version 3.0, page 168

"Microsoft Excel User's Guide," version 3.0, pages 139, 622

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 3.0 3.00 4.0 4.00 Q91632 4.0a 4.00a


Using a Logical AND or OR in a SUM+IF Statement in Excel

Article ID: Q77676

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, attempting to use the logical functions AND and/or

OR inside a SUM+IF statement to test a range for more than one

condition does not work properly. A nested IF statement gives this

functionality. However, this article discusses a second easier method

that uses the following formula:

   {=SUM(IF(Test1*Test2*...*Testn))}

MORE INFORMATION

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

A SUM+IF statement is used to count the number of cells in a range

that pass a given test OR to sum those values in a range for which

corresponding values in another (or the same) range meet the specified

criteria. This acts similarly to Microsoft Excel DSUM function.

Example

-------

This example counts the number of values in the range A1:A10 that fall

between 1 and 10, inclusively.

This can be accomplished by using the following nested IF statement:

   {=SUM(IF(A1:A10>=1,IF(A1:A10<=10,1,0)))}

The following method also works and is much easier to read if multiple

tests are to be conducted:

   {=SUM(IF((A1:A10>=1)*(A1:A10<=10),1,0))}

NOTE: Both formulas should be entered as array formulas by pressing

CTRL+SHIFT+ENTER simultaneously.

With this method, you are multiplying the results of one logical test by

another logical test to return TRUEs and FALSEs to our SUM function. These

can be equated to:

   TRUE*TRUE=1

   TRUE*FALSE=0

   FALSE*TRUE=0

   FALSE*FALSE=0

The method shown above counts the number of cells in the range A1:A10

for which both tests evaluate to TRUE. To sum values in corresponding

cells (for example, B1:B10), modify the formula as shown below:

   {=SUM(IF((A1:A10>=1)*(A1:A10<=10),B1:B10,0))}

You can implement an OR in a SUM+IF statement similarly. To do this,

modify the formula shown above by replacing the multiplication sign (*)

with a plus sign (+). This gives the following generic formula:

   {=SUM(IF((Test1)+(Test2)+...+(Testn),1,0))}

REFERENCES

==========

"User's Guide," version 4.0, pages 153-157

"User's Guide," version 3.0, pages 119-120

KBCategory: kbfasttip

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00  boolean


Using the [Init Commands] Section of the EXCEL.INI File

Article ID: Q77981

------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.0, 4.0, 5.0

------------------------------------------------------------------

SUMMARY

=======

The [Init Commands] section in the EXCEL.INI file (in version 5.0 the

EXCEL5.INI file) allow custom commands to be added to the Microsoft Excel

default menus without having to execute a macro to do so.

MORE INFORMATION

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

The general syntax for an entry in the [Init Commands] section appears

as follows:

Syntax for [Init Commands]

--------------------------

<Command_name>=<menu_#>,<menu_name>,<command>,<macro_name>,

               <position>,<blank>,<status_msg>,<help>

<Command_name> is the name you will use to distinguish one command

     from another. The command_name is required, but is essentially

     ignored by Excel and has no effect on the command or how it

     will appear in the menu.

<Menu_#> is the Excel default menu bar number in which you want the

     command to be available. A number 1 through 6 is required. If

     you want a command to be available in all six default menus,

     six separate [Init Command] entries are required.

<Menu_name> is the name, or number, of the menu under which you want

     the command to appear. Numbering the menus begins on the left,

     starting with 1.

<Command> is the actual command that will appear under the specified

     menu. As with all custom menu commands an ampersand (&) can be

     placed in front of the letter you want to make a menu accelerator

     key. This item is required.

<Macro_name> is the name of the macro you want to run when

     the custom command is selected. Unless there is no doubt that

     the macro or add-in will be open, the drive and path to the

     macro should be specified. When giving the drive and path,

     the macro_name parameter should take the following form:

        'C:\EXCEL\DATA\MACRO1.XLM'!TEST

     (Note the single quotation marks surrounding the drive, path, and

     sheet name.) This item is required.

     In version 5.0 when you refer to the macro file name, the name of the

     workbook must be in brackets, with the sheet name following.

        'C:\EXCEL\DATA\[BOOK1.XLS]MACRO1'!TEST

<Position> can be either the number representing the relative

     position the command should take in the command list or the

     name of the command above which you want your command to

     appear. Numbering begins with 1, starting from the top.

     Command names should be spelled just as they appear on the

     screen, including ellipses (...) if necessary. This item is

     optional, and entries without this parameter will appear at

     the bottom of the specified menu's command list.

<Blank> should always be left blank.

<Status_msg> is optional. The text you want to appear in the status

     bar when this command is selected should be placed here.

<help> specifies the help file and topic that should appear if the

     user presses F1 while the command is highlighted in the menu.

Sample Entry

------------

The following is an example:

   Test=1,File,&Test,'C:\EXCEL\MACRO.XLM'!TESTMACRO,1,,Load Test

        Macro,TESTHELP.HLP!10

The above sample entry will:

1. Create a menu item, Test, which will appear as the first item

   under the File menu. It will only appear on Menu Bar 1 (Full menus

   for worksheets and macro sheets).

2. The first "T" in Test will be underlined, denoting that "T" is an

   accelerator key.

3. The command will open the MACRO.XLM macro sheet from the C:\EXCEL

   directory and run the macro named TESTMACRO.

4. If F1 is pressed when the Test command is chosen, Windows Help will

   open the TESTHELP.HLP file and display topic number 10 in that

   file.

Note: Although the examples in this article appear on more than one line,

entries in the EXCEL.INI (EXCEL5.INI) file should appear on a single line.

The lines are word wrapped here for convenience.

The EXCEL.INF cannot be modified to include custom [Init Commands] entries.

REFERENCES

==========

"Online Help," version 5.0

"User's Guide 2," version 4.0, pages 286-290

"Function Reference," version 4.0, pages 8-9

"User's Guide," version 3.0, pages 646-650

"Function Reference," version 3.0, pages 5-6

EXCEL.INI. Excel for Windows version 3.0, WINDOWS directory

EXCEL.INF. Excel for Windows version 3.0, Excel 3.0 Setup Disk

KBCategory: kbusage

KBSubcategory:

Additional reference words: 3.0 3.00 4.0 4.00 5.0 5.00 solver


Excel: Floating-Point Arithmetic May Give Inaccurate Results

Article ID: Q78113

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

----------------------------------------------------------------------

SUMMARY

=======

Many combinations of arithmetic operations on floating-point numbers

in Microsoft Excel may produce results that appear to be incorrect by

very small amounts; for example, the expression (.5-.4-.1) evaluates

to the quantity (2.8E-17) or .000000000000000028 .

This behavior is not a bug or limitation of Microsoft Excel; it

results because the IEEE 754 floating-point standard requires that

numbers be stored in binary.

MORE INFORMATION

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

The IEEE 754 standard is a method of storing floating-point numbers in

a compact way that is easy to manipulate. This standard is used by

Intel coprocessors and most PC-based programs that implement

floating-point math.

IEEE 754 specifies that numbers be stored in binary format to reduce

storage requirements and allow the built-in binary arithmetic

instructions available on all microprocessors to process the data in a

relatively rapid fashion. However, some numbers that are simple,

nonrepeating decimal numbers convert into repeating binary numbers,

and cannot be stored with perfect accuracy.

For example, the number 1/10 can be represented in a decimal number

system with a simple decimal:

   .1

However, the same number in binary becomes the repeating binary

decimal

   .0001100011000111000111 (and so on)

and can be repeated as far as you want. This cannot be represented

in a finite amount of space. Therefore, this number will be rounded

down by approximately -2.8E-17 when it is stored.

If several arithmetic operations are performed to obtain a given result,

these rounding errors may build up until noticeable effects are obtained.

For additional information on this topic, query on the words:

   floating and point and rounding and excel

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21

3.0 3.00 4.0 4.00  5.00 5.00a 5.00c floating point


Excel: Ignoring Zero Values in the AVERAGE Function

Article ID: Q78195

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 1.x, 2.x, 3.0, 4.0,

   5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you use the AVERAGE function with a range of

values that includes zero values, the zero values are calculated in the

result. However, empty (blank) cells are ignored. You can modify either of

these behaviors by using the methods shown below.

MORE INFORMATION

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

Example 1

---------

On your worksheet, enter the following data:

   A1:  2

   A2:  3

   A3:  2

   A4:  0

   A5:  3

   A6:  =AVERAGE(A1:A5)

The number 2 is returned in cell A6.

To use the AVERAGE function on the range and ignore the zero value, enter

the following formula in cell A6:

   {=AVERAGE(If(A1:A5<>0,A1:A5,""))}

Do not enter the curly brackets manually. To enter the formula as an array

formula, press CTRL+SHIFT+ENTER simultaneously and the brackets are

automatically entered. The value 2.5 is returned.

Example 2

---------

There may be times when you would like to have the AVERAGE function treat

blank cells as zeros.

On your worksheet, enter the following data:

   A1:  2

   A2:  3

   A3:  2

   A4:

   A5:  3

   A6: =AVERAGE(A1:A5) will return the value 2.5.

To have the blank cell treated as a zero, change the formula in cell A6 to

the following:

   {=AVERAGE(IF(ISBLANK(A1:A5),0,A1:A5))}

Again, enter the curly brackets by pressing CTRL+SHIFT+ENTER

simultaneously. Do not attempt to type them in. This formula now returns

the value 2.

The techniques described above may be used with any Microsoft Excel

function that treats blanks in a range of cells differently from zeros.

REFERENCES

==========

"Function Reference," version 4.0, page 31

"Function Reference," version 3.0, page 20

"Functions and Macros," version 2.1, pages 30-31

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 5.00

IRR NPV MEDIAN COUNT COUNTA MAX MIN STDEV STDEVP VAR VARP


Excel: Can't Evaluate Link to Closed Document in Formula Bar

Article ID: Q81025

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

A portion of an Excel formula can be evaluated in the formula bar by

highlighting it and pressing COMMAND+= (equals sign) (F9 in Excel for

Windows). Links to closed documents will return a #REF! error when

evaluated in this way.

Microsoft Excel versions 3.0 and 4.0 will evaluate both complex and

simple references to closed documents in cells but not in the formula

bar. To determine the value of a link to a closed document, type the

external reference by itself into a cell on the spreadsheet.

For a definition of simple and complex links in Excel, query on the

following words:

   definition and simple and complex and links

REFERENCES

==========

"Microsoft Excel User's Guide," for the Macintosh, version 3.0, pages 288-

289

KBCategory: kbother

KBSubcategory:

Additional reference words: 3.0 3.00 4.0 4.00  5.00


Excel: File Translation Between Macintosh and Windows Versions

Article ID: Q81274

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.0, 4.0, 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The following information discusses the use of Apple File Exchange

software to convert Microsoft Excel files from Windows to Macintosh

and vice versa with any Apple Macintosh equipped with an FDHD (floppy

disk high density) drive. These drives come standard on Apple

Macintosh computers released after the SE/30, Mac IIc, and Mac IIcx.

This includes the Mac IIsi, Mac IIci, Mac IIfx, Mac LC, Mac Quadra

700, Mac Quadra 900, Mac IIvx, Mac Centris 610, Mac Centris 650,

Quadra 800, Quadra 950, Mac LC II, Mac LC III, Performa 200, Performa

400, Performa 405, Performa 430, Performa 450, Performa 600, Powerbook

140, Powerbook 145, Powerbook 160, Powerbook 165c, Powerbook 170,

Powerbook 180, Powerbook Duo 210, Powerbook Duo 230.

MORE INFORMATION

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

Apple's high-density drives can read MS-DOS and OS/2 disks in 720K and

1.44M formats, as well as 800K PRODOS and Apple's 400K, 800K, and

1.44M formats. Using the Apple File Exchange program (which is

supplied with all Apple operating systems), it is possible for an

Apple 3.5 inch drive to read and write to MS-DOS diskettes and

translate Microsoft Excel files to and from them.

NOTE: Apple File Exchange can be found on the Utilities 2 disk of

System 6 software, or the Tidbits disk of System 7 software.

Transferring Files later than Excel version 1.5 Across Either Platform

----------------------------------------------------------------------

1. Save the file in Normal format to a 3.5 inch disk (or to the

   hard drive on a Macintosh).

2. From the Macintosh, launch Apple File Exchange.

3. Insert the MS-DOS disk into the floppy drive.

4. Select the document(s) to be translated from the source dialog

   box.

5. Select the appropriate drive and folder level for the destination

   dialog box.

6. Choose "default translation" from the "MS-DOS to Mac" menu, if

   going from Windows to Macintosh, or the "Mac to MS-DOS" menu if

   going from Mac to Windows.

7. Click the Translate button.

8. Quit Apple File Exchange.

NOTE: Files traveling from Macintosh to Windows will have their names

truncated to adhere to MS-DOS limitations. This may cause name

conflicts. If this situation occurs, Apple File Exchange will allow

you to edit the file names before translation. For easiest

translation, insure that the first eleven characters of each Macintosh

file name are unique.

All versions of Microsoft Excel after 1.5 can read files translated

from another platform according to the same limitations governing all

versions of the program, that is, later versions of the application

can read files from earlier versions, but not vice versa. In order to

read a Microsoft Excel for Windows version 3.0 file in Microsoft Excel

for the Macintosh version 2.2, for example, that file should be saved

in Microsoft Excel 2.1 file format in Windows before translation

through Apple File Exchange.

Transferring Excel version 1.5 and Earlier Across Either Platform

-----------------------------------------------------------------

Follow the steps above except:

1. Save the file in SYLK format before translation.

2. Choose "text translation" from either the "MS-DOS to Mac" or "Mac

   to MS-DOS" menus.

REFERENCES

==========

"User's Guide," version 4.0, pages 60-61

"User's Guide," version 3.0 for Windows, pages 138-140

"User's Guide," for the Macintosh, version 3.0, pages 132-133

KBCategory: kb3rdparty

KBSubcategory:

Additional reference words: 2.1 2.10 2.2 2.20 3.0 3.00 4.0 4.00


XL Err Msg: 'Error in Formula' If Filename Starts with Number

Article ID: Q81318

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for OS/2, version 3.0

 - Microsoft Excel for the Macintosh, versions 3.x, 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SYMPTOMS

========

When you use a linked formula in Microsoft Excel, the formula will return

the error message "Error in Formula" if either the following conditions is

true:

 - The filename of the supporting worksheet begins with a number such

   as 1ABC.XLS.

   -or-

 - The worksheet name in the formula is not enclosed in apostrophes (').

WORKAROUND

==========

To avoid receiving this error message and to properly link the worksheets,

use any of the following methods:

Method 1: On the dependent sheet, type your formula as

             = '[<workbook>]<sheet>'!<reference>

          where <workbook> and <sheet> are the workbook and sheet names

          enclosed in apostrophes, and <reference> is the cell or range

          reference.

          NOTE: If you are using Microsoft Excel version 4.x or earlier,

          use this formula:

             ='<Filename.xls>'!<reference>

Method 2: If the filename (workbook and sheet) is used as a defined name in

          a function, then you can use the following formula

             =INDIRECT("'"&<filename>&"'!<reference>")

          where <filename> is a defined name and <reference> is a cell or

          range of cells on the sheet.

Method 3: If you are using Microsoft Excel version 3.0, follow the

          "Creating a linking formula that uses functions" procedure

          described on page 311 of the "User's Guide," version 3.0. For

          Microsoft Excel version 3.0 for the Macintosh, see page 305 of

          the "User's Guide."

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

REFERENCES

==========

"User's Guide," version 4.0, pages 364-369

"Microsoft Excel User's Guide," for Windows, version 3.0, pages 311-313

"Microsoft Excel User's Guide," for the Macintosh, version 3.0, page 305

KBCategory: kbother

KBSubcategory:

Additional reference words: 2.10 2.1 2.10c 2.1c 2.10d 2.1d 3.00 3.0 err msg

4.0 4.00


Excel: Functions Recalculated If New Data or Cells Entered

Article ID: Q81856

----------------------------------------------------------------------

The information in this article applies to :

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 2.2, 3.x, 4.x, 5.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you use the AREAS(), INDEX(), OFFSET(), CELL(),

INDIRECT(), ROWS(), COLUMNS(), NOW(), RAND(), or TODAY() functions, the

formulas that use these functions are recalculated when either of the

following occur:

 - You enter new data

   -or-

 - You insert or delete cells, rows, or columns on the worksheet

This recalculation occurs regardless of whether cells are dependent on the

new data.

WORKAROUNDS

===========

To disable automatic recalculation, do either of the following:

 - Choose Options from the Tools menu, select the Calculation tab and

   select the Manual option under Calculation (version 5.0) or choose

   Calculation from the Options menu and select the Manual option under

   Calculation.

   -or-

 - Avoid using the following functions:

      AREAS()

      INDEX()

      OFFSET()

      CELL()

      INDIRECT()

      ROWS()

      COLUMNS()

      NOW()

      RAND()

MORE INFORMATION

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

This functionality can be compared to the VOLATILE() macro function and the

Visual Basic, Applications Editions Volatile method (Version 5.0 only) in

Microsoft Excel. You can use the VOLATILE function, or the Volatile method

in a user-defined function to cause the custom function to be recalculated

under the same circumstances of data entry, insertions, and deletions.

Example for Microsoft Excel version 5.0

---------------------------------------

1. In a new module, enter the following:

      Function FeetPerSecond(MilesPerHour as Double) as Double

         Application.Volatile

         FeetPerSecond=MilesPerHour*5280/3600

      End Function

2. On a worksheet, select the range A1:C50.

3. In the Formula bar, type the formula "=feetpersecond(60) quote (without

   the quotation marks).

   NOTE: This value must be entered as an array formula. To enter a formula

   as an array formula in Microsoft Excel for Windows or Microsoft Excel

   for OS/2, press CTRL+SHIFT+ENTER. In Microsoft Excel for the Macintosh,

   press COMMAND+ENTER.

4. Enter any number into cell D1 and note that the worksheet is

   recalculated.

Because this user-defined function contains the Volatile method, this

function is recalculated every time you enter data or insert or delete

cells, columns or rows into any open worksheet. If the FeetPerSecond user-

defined function did not contain the Volatile method, entering data into a

cell would not cause a recalculation to occur.

Example for Microsoft Excel versions 3.0 and 4.0

------------------------------------------------

1. Enter the following into a macro sheet:

   A1:   FeetPerSecond

   A2:   =ARGUMENT("MilesPerHour",1)

   A3:   =VOLATILE()

   A4:   =RETURN(MilesPerHour*5280/3600)

2. Select cell A1 and choose Define Name from the Formula menu. Select

   the Function option in the Macro section and choose OK.

3. Open a new worksheet and select cells A1:C50.

4. Choose Paste Function from the Formula menu. Scroll to the end of

   the listed functions. Select MACRO1!FeetPerSecond(MilesPerHour)

   (without quotation marks) and choose the OK button.

5. In the formula bar, replace MilesPerHour with "60" (without the

   quotation marks).

   NOTE: This value must be entered as an array formula. To enter a formula

   as an array formula in Microsoft Excel for Windows or Microsoft Excel

   for OS/2, press CTRL+SHIFT+ENTER. In Microsoft Excel for the Macintosh,

   press COMMAND+ENTER.

    Microsoft Excel will return the value 88 in cells A1:C50.

6. Enter any number into cell D1 and note that the worksheet is

   recalculated.

Because this user-defined function has been defined with the VOLATILE

function, this function will be recalculated every time you enter data or

insert or delete cells, columns or rows into any open worksheet. If the

FeetPerSecond user-defined function did not contain the VOLATILE function,

entering data into a cell would not cause a recalculation to occur.

The functions listed above can be thought of as containing this VOLATILE

function or method.

NOTE: In versions of Microsoft Excel earlier than version 3.0, the function

OFFSET() was available as a macro function only, not as a worksheet

function. The macro function VOLATILE() is not available in versions of

Microsoft Excel earlier than version 3.0.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, page 451

"Microsoft Excel Function Reference," version 3.0, page 247

KBCategory: kbusage kbprg

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 4.00a

5.00 workbook udf


Excel: Solver Uses Generalized Reduced Gradient Algorithm

Article ID: Q82890

--------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a, 5.0,

   5.0c

 - Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0,

   5.0a

---------------------------------------------------------------

SUMMARY

=======

Microsoft Excel Solver uses the Generalized Reduced Gradient (GRG2)

Algorithm for optimizing nonlinear problems. This algorithm was developed

by Leon Lasdon, of the University of Texas at Austin, and Allan Waren, of

Cleveland State University.

Linear and integer problems use the simplex method with bounds on the

variables and the branch and bound method, implemented by John Watson and

Dan Fylstra, of Frontline Systems, Inc.

MORE INFORMATION

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

Microsoft Excel Solver uses iterative numerical methods that involve

"plugging in" trial values for the adjustable cells and observing the

results calculated by the constraint cells and the optimum cell. Each trial

is called an "iteration." Because a pure "trial and error" approach would

an extremely long time (especially for problems involving many adjustable

cells and constraints), Microsoft Excel Solver performs extensive analyses

of the observed outputs and their rates of change as the inputs are varied,

to guide the selection of new trial values.

In a typical problem, the constraints and the optimum cell are functions of

(that is, they depend on) the adjustable cells. The (first derivative of a

function measures its rate of change as the input is varied. When there are

several values entered, the function has several partial derivatives

measuring its rate of change with respect to each of the input values;

together, the partial derivatives form a vector called the gradient of the

function.

Derivatives (and gradients) play a crucial role in Microsoft Excel Solver's

iterative methods. They provide clues as to how the adjustable cells should

be varied. For example, if the optimum cell is being maximized and its

partial derivative with respect to one adjustable cell is a large positive

number, while another partial derivative is near zero, Microsoft Excel

Solver will probably increase the first adjustable cell's value on the next

iteration. A negative partial derivative suggests that the related

adjustable cell's value should be varied in the opposite direction.

Forward and Central Differencing

--------------------------------

Microsoft Excel Solver approximates the derivatives numerically by moving

each adjustable cell value slightly and observing the rate of change of

each constraint cell and the optimum cell. This process is called a finite

difference estimate of the derivative. Microsoft Excel Solver can use

either forward differencing or central differencing, as controlled by the

Derivatives choice on the Solver Options dialog box.

Forward differencing uses a single point (that is, set of adjustable cell

values) that is slightly different from the current point to compute the

derivative, while central differencing uses two points in opposite

directions. Central differencing is more accurate if the derivative is

changing rapidly at the current point, but requires more recalculations.

The default choice is forward differencing, which is fine in most

situations.

Linear problems can be solved with far less work than nonlinear problems:

Microsoft Excel Solver does not need to recompute changing derivatives, and

it can extrapolate along straight lines instead of recalculating the

worksheet. These time savings are brought into play when you select the

Assume Linear Model check box in the Solver Options dialog box. If you

don't select this box, Microsoft Excel Solver can still solve the problem,

but it will spend extra time doing so.

When you know that a problem is completely linear, choosing the Assume

Linear Model option will speed up the solution process by a factor of

anywhere from two to twenty times (depending on the size of your

worksheet). The downside is that, if the real worksheet formulas are

nonlinear and this option is chosen, you will be solving the wrong problem.

Although Microsoft Excel Solver does check the final solution when Assume

Linear Model is checked using a full worksheet recalculation, this is not

an absolute guarantee that the problem was truly linear. You can always

recheck the solution by running the same problem with the check box

cleared.

Many business worksheets contain mostly linear formulas plus a few key

nonlinear relationships, such as the Revenue equals Price times Unit Volume

example cited earlier. These problems are not amenable to the methods of

linear programming or the Assume Linear Model option, but require the full

power of nonlinear programming. The Generalized Reduced Gradient method

used by Microsoft Excel Solver is quite efficient on problems of this type,

because it uses linear approximations to the problem functions at a number

of stages in the solution process; when the actual functions are linear,

these approximations are exact.

Optimality Conditions

---------------------

Because the first derivative (or gradient) of the optimum cell measures its

rate of change with respect to (each of) the adjustable cells, when all of

the partial derivatives of the optimum cell are zero (that is, the gradient

is the zero vector), the first-order conditions for optimality have been

satisfied (some additional second order conditions must be checked as well)

having found the highest (or lowest) possible value for the optimum cell.

Multiple Locally Optimum Points

-------------------------------

Some problems have many locally optimum points where the partial

derivatives of the optimum cell are zero. A graph of the optimum cell

function in such cases would show many hills and valleys of varying heights

and depths. When started at a given set of adjustable cell values, the

methods used by Microsoft Excel Solver will tend to converge on a single

hilltop or valley floor close to the starting point. But Microsoft Excel

Solver has no sure way of knowing whether there is a taller hilltop, for

example, some distance away.

The only way to find the global optimum is to apply external knowledge of

the problem. Either through common sense reasoning about the problem or

through experimentation, you must determine the general region where the

global optimum lies, and start Microsoft Excel Solver with adjustable cell

values that are within that region. Alternatively, you can start Microsoft

Excel Solver from several different, widely separated points and see which

solution is best.

For more information on Solver's internal solution process, contact:

   Frontline Systems

   P.O. Box 4288

   Incline Village, Nevada  89450-4288

   (702) 831-0300

The Microsoft Excel Solver program code is copyright 1990, 1991, 1992 by

Frontline Systems, Inc. Portions copyright 1989 by Optimal Methods, Inc.

REFERENCES

==========

"Microsoft Excel Solver User's Guide" for the Macintosh, version 3.0,

page 2

"Microsoft Excel Solver User's Guide" for Windows, version 3.0, page 2

KBCategory: kbother

KBSubcategory:

Additional reference words: 3.00 4.00 4.00a  GRG2 5.00


Excel or Project: GP Fault in WIN87EM.DLL

Article ID: Q84701

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0

 - Microsoft Project for Windows, version 4.0

----------------------------------------------------------------------

SUMMARY

=======

Random problems may occur when you run Microsoft Excel for Microsoft

Windows operating environment version 3.1 on a 386-based computer with

an Intel i387 math coprocessor installed.

MORE INFORMATION

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

The following list is not all-inclusive. Since this problem is related

to timing conditions, a wide and unpredictable variety of symptoms may

be experienced. Following are some of the more common problems:

 - A General Protection Fault occurs in WIN87EM.DLL

 - When exiting Microsoft Excel, Windows exits to the MS-DOS prompt

 - Starting Microsoft Excel results in a General Protection Fault in

   an unknown module

 - Solver reports a hardware error with floating point calculations

 - Crosstabs fails in the middle of a calculation

These problems have all been traced to a timing problem between the

WIN87EM.DLL and certain Intel i387 math coprocessors. There is a new

version of WIN87EM.DLL that corrects this problem.

How to get the new version of this file

---------------------------------------

This file is available through any of these sources:

 - Intel bulletin board service at (503) 645-6275.

 - The Microsoft Download Service (206) 936-6735, in the APPNOTES

   Section.

To get to the APPNOTES section, choose the FILES section, the the

WINDOWS section, then to APPNOTES.

The filename to download is: WIN87EM.EXE.

 - CompuServe, by doing the following:

   1. At the ! prompt, type "GO MSEXCEL" (without quotation marks).

   2. Choose LIBRARIES.

   3. Choose LIBRARY 3.

   4. Download WIN87EM.DLL.

 - As an appnote from Microsoft Product Support Services at (206)

   635-7070.

The appnote (WW0548) is titled, "WIN87EM.DLL Patch for Intel 80387."

KBCategory: kbenv

KBSubcategory:

Additional reference words: GP Fault GPF 4.00 win87emm invalid

register ID


Excel: Random Number Generation

Article ID: Q86523

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 1.x, 2.x, 3.x, 4.x,

   5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The Microsoft Excel, the RAND() function uses the following iterative

method to calculate pseudo-random numbers:

The first random number:

   random_number=fractional part of (9821 * r + 0.211327),

   where r = .5

Successive random numbers:

   random_number=fractional part of (9821 * r + 0.211327),

   where r = the previous random number

This formula will provide up to 1 million different numbers.

MORE INFORMATION

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

Computers cannot generate truly random numbers. Instead, they return a

series of numbers based on a mathematical relationship that simulates

"randomness." The "randomness" exhibited by the numbers is a function

of the mathematical formula used by the random number generator.

In Microsoft Excel for Windows, adding randomize=1 to the [Microsoft Excel]

section of the appropriate .INI file for your version of Microsoft Excel

will cause "r" to be determined from the system clock (which adds a further

degree of randomness to the numbers generated).

   For this version         The name of your

   of Microsoft Excel       .INI file is this

   -----------------------------------------

   5.0                      EXCEL5.INI

   4.0                      EXCEL4.INI

   3.0                      EXCEL.INI

Note that there is no such setting with Microsoft Excel for OS/2 or

Microsoft Excel for the Macintosh.

NOTE: Excel 5.0 defaults to the RANDOMIZE=1 setting. Previous versions of

Microsoft Excel defaulted to RANDOMIZE=0.

KBCategory: kbother

KBSubcategory: xlwin

Additional reference words: 7.00 5.00 1.0 1.00 1.03 1.04 1.06 1.5 1.50 2.0

2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 3.00 4.0 4.00  rand random

algorithm


Excel: Calculating Work Hours for a Given Time Period

Article ID: Q87855

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

Using Microsoft Excel, you can write a formula to calculate the hours

and minutes in a given period of time, based on an hourly workday.

This can be useful for calculating time spent on a project.

MORE INFORMATION

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

The following example calculates elapsed time based on an 8 hour

workday that runs from 8:00 AM to 5:00 PM with 1 hour off for lunch.

This formula uses DAYS360() which bases its calculation on a 360 day

year (12 30-day months). For a more exact number of days you can use

subtraction. For example, you could change A6 to read:

A6: =(INT(A2)-INT(A1))*A3

The comments in column B describe the values in corresponding cells in

column A.

 A1: 6/1/92 8:00 AM      B1: Start time

 A2: 6/5/92 5:00 PM      B2: End time

 A3: 8                   B3: Number of hours per day

 A4: 1                   B4: Lunch/Break time (in hours)

 A5:

 A6: =ABS(DAYS360(A1,A2)*A3)

 A7: =ABS((HOUR(A2)-HOUR(A1))-A4+INT((MINUTE(A2)-MINUTE(A1))/60))

 A8: =MINUTE(IF(A2-A1<0,60+A2-A1,A2-A1))

 A9:

A10: =SUM(A6,A7)&":"&TEXT(A8,"00")

The formulas in cells A6 and A7 calculate the number of hours in the

time interval. The formula in cell A8 calculates any remainder in

minutes. The formula in cell A10 combines the results of the three

formulas, using concatenation to display the total time in "hh:mm"

format.

NOTE: The results of this formula include weekends and holidays. In

version 4.0 of Excel you can modify the forumla to exclude weekends

and holidays.

To exclude weekends and holidays, replace the formula in cell A6 with:

 A6: =ABS((NETWORKDAYS(A1,A2)-1)*A3)

NETWORKDAYS() returns the number of full working days (excluding

weekends and holidays) between two dates. This function is not

available in versions earlier than Excel 4.0.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, pages 1, 95, 222,

244, 275, 284

"Microsoft Excel Function Reference," version 3.0, pages 1, 46, 123,

133, 152

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 elapsed change difference 3.0 3.00

4.0 4.00


Excel: Can't Use Spelling Tool If Custom Dictionary Corrupted

Article ID: Q88587

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel for Windows, if the Custom Dictionary file (CUSTOM.DIC)

has become corrupted, when you choose the Spelling command, either of the

following may occur:

 - The hourglass is displayed and then disappears, but the Spelling tool is

   not started.

   -or-

 - You receive the error message "Cannot read custom dictionary."

RESOLUTION

==========

To correct this problem, delete or rename the CUSTOM.DIC file (this file is

located in the MSAPPS\PROOF subdirectory of your WINDOWS directory). You

will be prompted to re-create the CUSTOM.DIC file the first time you run

the Spelling tool in Microsoft Excel. After you delete or rename the file,

the Spelling tool works correctly.

REFERENCES

==========

"User's Guide 1," version 4.0, pages 257-259

KBCategory: kbusage

KBSubcategory:

Additional reference words: 4.0 4.00 5.0 5.00 spell hang hour glass

away check fail fails checker spell


Excel: YEARFRAC Does Not Count Extra Day in Leap Years

Article ID: Q89031

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the YEARFRAC function does not recognize leap

years, such as 1992, unless the leap date (for example, 2/29/92) is

between the starting and ending dates.

MORE INFORMATION

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

Note that the results in following examples are the results that are

returned in Microsoft Excel version 5.0. The results returned in Microsoft

Excel version 4.0 are slightly different, although the same behavior

occurs.

For more information on the YEARFRAC function returning different values in

Microsoft Excel version 5.0 than in Microsoft Excel version 4.0, query on

the following words in the Microsoft Knowledge Base:

   yearfrac and different

Example 1

---------

This example shows that YEARFRAC uses 365 days in the denominator

instead of the 366 days in a leap year.

   YEARFRAC(DATEVALUE("01/01/92"), DATEVALUE("02/01/92"),1)

This function returns .084932, which is 31/365.

Example 2

---------

This example shows that YEARFRAC uses 366 days in the denominator

since the leap date falls between the starting and ending dates.

   YEARFRAC(DATEVALUE("01/01/92"), DATEVALUE("06/01/92"),1)

This function returns .415301, which is 152/366.

YEARFRAC uses 366 days in the denominator only when the leap day falls

between the start date and the end date.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, page 469

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 4.00 5.00


Excel: INTRATE() Function Uses Simple Interest

Article ID: Q89942

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the INTRATE() function returns the interest rate for a

fully invested security. This function uses simple interest rather than

compound interest to compute the interest rate.

MORE INFORMATION

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

The INTRATE() function has a special use for fully invested securities. The

interest rate returned is prorated (or inversely prorated) to the number of

days between redemption and settlement.

This function cannot be modified to take into account compounding interest.

To compute compound interest we have to know the settlement, the

redemption, the first payment day and the frequency of payments.

Compounding between two dates does not make sense without this additional

information.

INTRATE() estimates an average rate over the period of time. You can use

NOMINAL() to approximate the rate without knowing the number of periods

between the two dates.

REFERENCES

==========

Online Help, version 5.0, INTRATE function

"Function Reference," version 4.0, pages 245-246, 286-287

For more information about the INTRATE function, choose the Search button

in Microsoft Excel Help and type:

    INTRATE function

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 4.0 4.00 5.0 5.00 Analysis Financial


Excel: Solver Error Value in a Target or Constraint

Article ID: Q90185

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when setting constraints for a Solver problem, if you

type the word "integer" (without the quotation marks) in the Constraint box

in the Add Constraint dialog box, Solver fails.

MORE INFORMATION

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

Excel Solver finds solutions to problems such as maximizing profits or

adjusting expenditures to fit within a given budget. When using

Solver, you specify various parameters, including constraints on the

values that can be used. One possible constraint is "integer," which

tells Solver that the number must be a positive or negative whole

number or zero.

For example, if you're selling cars, you don't want Solver to tell you

that the way to trim your budget is to sell only half a car or -3

cars. In this case, you want to constrain the number of cars sold to

an integer value that is greater than, or equal to, 0 (zero).

When adding constraints to your Solver model in the Add Constraint

dialog box, if you type the word "integer" into the Constraint box and

choose the Add button, Solver adds your constraint; however, if you

then choose the OK button in the Add Constraint dialog box, Solver

displays the message:

   Constraint must be a number, simple reference, or a formula with a

   numeric value.

When you choose the OK button in this message box, Solver returns you

to the Add Constraint dialog box. If you then choose the Cancel button

(or if you originally chose the Cancel button after choosing Add) in

the Add Constraint dialog box, Solver returns you to the Solver

Parameters dialog box.

If you now choose the Solve button in the Solver Parameters dialog

box, Solver attempts to find a solution but fails.

Solver displays the Solver dialog box containing the error message:

   Solver encountered an error value in a target or constraint cell

To properly constrain a value to an integer, select "int" from the

list that contains the comparison operators (<=, = >=) in the Add

Constraint dialog box. Notice that when you select int from the list,

Solver enters the word "integer" in the Constraint box.

REFERENCES

==========

"Microsoft Excel User's Guide 2," version 4.0, pages 79-120

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 4.0 4.00


Third-Party Vendors of Microsoft Excel-Related Products

Article ID: Q90508

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0

----------------------------------------------------------------------

SUMMARY

=======

The following is a list of third-party vendors who provide additional

tools, macros, templates, books, and training products for use with

Microsoft Excel. Some of these vendors may offer add-in macros and

templates for earlier versions of Microsoft Excel and for both Microsoft

Excel for Windows and Microsoft Excel for the Macintosh.

For more information, please call the vendor listed.

The products mentioned here are manufactured by vendors independent of

Microsoft; we make no warranty, implied or otherwise, regarding these

products' performance or reliability.

MORE INFORMATION

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

These third-party vendors provide additional tools, macros, and templates

for Microsoft Excel:

Tools, Templates, and Macros

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

   Real estate templates and macros

   A la Mode, Inc.

   (801) 268-6911

   4547 S. 700 E.

   Suite 200

   Salt Lake City, UT 84107.

   Financial and investment planning

   Apropos Software, Inc.

   64 Hillview Avenue

   Los Altos, CA 94022

   DIF to SYLK conversions

   Template Systems, Inc.

   (617) 533-2203

   7 Industrial Park Rd.

   Medway, MA 02053.

   Personal income tax templates and schedules

   James Associates

   (303) 484-5296

   1525 East County Road 58

   Fort Collins, CO 80524.

   Real estate and personal finance templates

   Real Data, Inc.

   (203) 255-2732

   P.O. Box 691

   Southport, CT 06490.

   Individual Software Inc.

   5870 Stoneridge Drive, #1

   Pleasanton, CA  94588

   (415) 734-6767

   Customer Support: (800) 822-3522

The following vendors also provide custom macros for Microsoft Excel:

   NOTE: Heizer Software has sold their Microsoft Excel business division

   to Baarns Consulting Group.

   The Baarns Utilities for MS Excel, Custom add-ins

   and Expert Corporate Development Using Microsoft Excel

   Baarns Consulting Group, Inc.

   (800)377-XCEL (9235)

   12807 Borden Avenue

   Sylmar, CA 91342.

   @Risk for Excel: A risk analysis tool.

   Palisade Corporation

   31 Decker Road

   Newfield, NY 14867 USA

   (607) 277-8000

   Evolver: An all-purpose problem solver.

   Axcellis

   4668 Eastern Ave. N.

   Seattle, WA 98103-6932 USA

   (206) 632-0885 Customer line

   (206) 632-3681 Fax

   Statistics: A set of complex statistical analysis tools.

   Spreadware

   P.O. Box 4552

   Palm Desert, CA 92261-4552

   (619) 360-7881

   Crystal Ball: What-if analysis tools.

   Decisioneering Inc.

   1380 Lawrence Street, Suite 610

   Denver, CO 80204 USA

   (303) 449-5177

   Braincel: Tools for forecasting using neural network

   technology.

   Promised Land Tech. Inc.

   900 Chapel St. Suite 300

   New Haven, CT 06510

   (203) 562-7335

Training Products and Books

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

These vendors provide additional training products and books for Microsoft

Excel:

   Personal Training Systems

   Training products covering Excel fundamentals, business

   graphing, databases, linking spreadsheets and macros

   (408) 559-8635

   P.O. Box 54240

   San Jose, CA 95154.

   The Cobb Group

   Monthly journal and books for Microsoft Excel users

   (800) 223-8720 or (502) 425-7756

   P.O. Box 24480

   Louisville, KY 40224.

   "Microsoft Excel Visual Basic for Applications Reference"

   Microsoft Corporation

   $24.95 ($33.95 Canada)

   ISBN 1-55615-624-3

   "Microsoft Excel Visual Basic for Applications Step by Step"

   Reed Jacobson,

   $29.95 ($39.95 Canada)

   ISBN is 1-55615-589-1

Microsoft Press books can be found in bookstores everywhere, through

CompuServe electronic mail (type GO MSP), or you can order direct by

calling (800) MSPRESS. In Canada, call (416) 293-8464, extension 340.

If you are outside the United States, contact the Microsoft subsidiary for

your area. To locate your subsidiary, call Microsoft International Customer

Service at (206) 936-8661.

   Excel 5 Courseware Developer's Kit (CDK)

   Microsoft Corporation

   $895 US ($1195 Canada)

   (Win) ISBN 1-55615-719-3

Includes license agreement (grants permission to customize the student

book, the student practice files, and the instructor outline files for

reproduction), eight disks (student practice files and student book on

disk), Instructor's guide, certificate of completion master copy, hardcopy

overhead and handout masters, and a template for creating your own lessons

   Microsoft Excel 5 Software Development Kit

   $49.95 ($69.95 Canada)

   ISBN 1-55615-632-4

   (Available in April)

KBCategory: kb3rdparty

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 3.00 4.00 4.00a 5.00 macro

developer phone writer books 3rdparty 3pty telephone isv phoneref third

party macros programs


Excel: Algorithm Used by the XIRR() Function

Article ID: Q90728

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

The following information describes the algorithm used by the XIRR()

function in version 4.0 of Microsoft Excel to compute the internal

rate of return on a schedule of cash flows that are not necessarily

periodic, that is, payments may be made at different time intervals.

MORE INFORMATION

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

Version 4.0 of Excel includes a function called XIRR() which returns

the internal rate of return for a schedule of cash flows that are not

necessarily periodic. This function is similar to the IRR() function

which returns the internal rate of return for a series of periodic

cash flows.

NOTE: If the XIRR() function is not available, you must install the

Analysis ToolPak add-in macro. For more information, see "Managing

Add-in Commands and Functions" in chapter 4 of the "Microsoft Excel

User's Guide 2."

With IRR(), all cash flows are discounted using an integer number of

compounding periods. For example, the first payment is discounted one

period, the second payment two periods, and so on.

With XIRR(), we want to permit payments to occur at unequal time

periods. Our approach is to associate a date with each payment and

thereby permit fractional periods (raising or discounting with a

fractional power).

The next step is to arrive at the correct discounting rate. Basically,

the larger the rate, the more the values are reduced.

We set bounds on the discount rate above and below the correct rate by

doubling guesses in each direction. With known upper and lower bounds,

we use Newton's method to find the appropriate guess to any level of

accuracy.

At each stage we perform the discounting calculation.

NOTE: Newton's method is a way to zoom in on a root of an equation

(y=f(x)) by using the tangent line to the equation's curve at

successive x-values. The new x-value keeps getting closer and closer

to the root of the equation until you reach some preset precision.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, pages 466-467

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00 4.0 4.00 atp toolpack tool pack


Excel: Displaying Automatic Page Breaks

Article ID: Q92364

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0

----------------------------------------------------------------------

SUMMARY

=======

To display automatic page breaks in Microsoft Excel, follow the appropriate

procedure below.

Microsoft Excel Version 5.0 and later

-------------------------------------

1. From the Tools menu, choose Options.

2. Select the View tab.

3. In the Window Options box, select the Automatic Page Breaks option.

   Choose OK to accept the change.

Microsoft Excel Versions 3.0, 4.0

---------------------------------

1. From the Options menu, choose Display.

2. In the Display Options dialog box, select the Automatic Page Breaks

   check box.

NOTE: Because the Automatic Page Breaks option is not saved with your

document, the next time you open your worksheet you will need to reselect

this option to display automatic page breaks.

Microsoft Excel Version 2.0 and later

-------------------------------------

1. From the File menu, choose Page Setup.

2. In the Page Setup dialog box, choose the OK button.

    -or-

1. From the File menu, choose Print.

2. In the Print dialog box, select the Print Preview check box.

3. Choose the OK button.

NOTE: To avoid printing your document, choose the Cancel button in

Print Preview.

MORE INFORMATION

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

When you print a worksheet, Microsoft Excel divides it into pages based on

print area, paper size, orientation, font size, and margin settings. The

page divisions are marked by automatic page breaks, indicated by dashed

lines in your worksheet. Automatic page break marks are displayed after you

use Page Setup, Print Preview, or after you select the Display option.

In Microsoft Excel versions 4.0 and 5.0, if the Fit to Pages scaling option

is turned on, no page breaks (either automatic or manual) will ever be

displayed or used. To display page breaks, you must turn off the Fit to

Pages option.

REFERENCES

==========

"Microsoft Excel User's Guide 1," version 4.0, Pages 530-537

"Microsoft Excel User's Guide," version 3.0, Pages 536-539

KBCategory: kbother

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00 5.0

5.00 view save show


Excel: Columns Half Width or Invisible in Column Chart Overlay

Article ID: Q93862

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you use a column chart overlay with a line chart,

the first and last columns in the column chart overlay may be displayed at

half the width of the other columns or they may not be visible at all.

WORKAROUND

==========

To display the chart so that the columns are all displayed and are all the

same width, use the appropriate method below.

Method 1: If you are using Microsoft Excel version 5.0 or later:

          1. Select the chart and click AutoFormat on the Format menu.

          2. Under Galleries, click Combination, and click the first option

             in the Formats box.

Method 2: If you are using Microsoft Excel version 4.0a or earlier:

          Use the following steps to use the Combination Chart 3 in the

          Combination dialog box (from the Gallery menu, choose

          Combination), and remove the y-axis value overlay.

          1. From the Gallery Menu, choose Combination.

          2. In the Chart Gallery dialog box, select option 3.

          3. Choose the OK button.

          4. From the Format menu, choose Overlay.

          5. In the Format Chart dialog box, select Column from the Overlay

             Chart Type list.

          6. Choose the OK button.

          7. From the Chart menu, choose Axes.

          8. In the Axes dialog box, clear the Value (Y) Axis option under

             Overlay.

          9. Choose the OK button.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 2.1c 2.10c 2.1d 2.10d

3.0 3.00 4.0 4.00 4.0a 4.00a over lay 3D 5.00 5.00a 7.00


Excel: How to Run a Word for Windows Macro from Excel

Article ID: Q94364

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel for Windows, you can use the EXECUTE() function to

run version 2.0 Microsoft Word for Windows macros in a dynamic data

exchange (DDE) macro.

MORE INFORMATION

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

Microsoft provides macro examples for illustration only, without

warranty either expressed or implied, including but not limited

to the implied warranties of merchantability and/or fitness for

a particular purpose. This macro is provided 'as is' and Microsoft

does not guarantee that the following code can be used in all

situations. Microsoft does not support modifications of the code

to suit customer requirements.

The following is a sample macro that runs a Microsoft Word for Windows

macro called TEST from Microsoft Excel. In order to run this macro,

use the WordBasic command ToolsMacro in the EXECUTE() function.

   A1:   =INITIATE("winword","system")

   A2:   =EXECUTE(A1,"[ToolsMacro.Name=""TEST"",.Run]")

   A3:   =TERMINATE(A1)

   A4:   =RETURN()

For more information about the ToolsMacro function choose Help Index

from the Help menu in Word for Windows, search on WordBasic, select

WordBasic Programming Language, choose the Go To button, and select

ToolsMacro from the list of WordBasic functions and statements.

Explanation of Macro

--------------------

A1: Initiates the channel to Word for Windows.

A2: Executes the ToolsMacro WordBasic command to run the macro called

    "TEST".

    NOTE: The two quotation marks on each side of the macro name are

    required to produce the one set of quotation marks needed by Word.

A3: Terminates the DDE channel to Word for Windows.

A4: Ends the macro.

REFERENCES

==========

"Function Reference," version 4.0, pages 139-140

"Function Reference," version 3.0, pages 71-72

KBCategory: kbinterop

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 4.0a 4.00a 5.0 5.00

word basic run


Excel: Regression Tool Error If More Than 16 X Ranges

Article ID: Q94631

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the Regression analysis tool, included in the Analysis

ToolPak add-in macro, has an X-range limit of 16. If you attempt to specify

more than 16 X ranges, you will receive a #REF! error value if you are

using version 4.0 or 4.0a. If you are using version 5.0, the #REF error

values are no longer displayed because the regression isn't allowed to run.

Instead, an Alert box is displayed saying "Regression - Input X Range

cannot contain more than 16 variables (columns)."

MORE INFORMATION

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

The Regression analysis tool uses the LINEST() function to perform linear

regression calculations. Since LINEST() has an X-range limit of 16, the

Regression analysis tool has the same limitation.

REFERENCES

==========

"Microsoft Excel User's Guide 2," version 4.0, pages 41-45

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 toolpack tool pack pak dialog box  atp

LINEST LOGEST TREND GROWTH 4.0 4.00 4.0a 4.00a 5.0 5.00


Excel: Changing the Date or Time Format in a Header or Footer

Article ID: Q94870

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.2, 3.x, 4.x, 5.0,

   5.0a

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you use the date code (&D) to enter the date

in the header or footer of a document, the date will appear in the

default MM/DD/YY format. The time code (&T) will default to the H:MM

AM/PM format.

These date and time formats are based on the date and time settings in

the Control Panel both for the Macintosh operating system and for

versions 3.0 and later of Microsoft Windows.

If you change the format in the Date and Time settings on the Macintosh,

you still have only short dates (5/20/94) and not long dates (May 20,

1994).

To use a date or time format other than the default, do one of the

following:

 - Enter the date or time manually in a different format.

   -or-

 - Create a macro to change the format.

   -or-

 - Change the date or time format in Control Panel (when using

   System 7.1 on the Macintosh this can be done by using the Date

   And Time Control Panel, or in Windows 3.0 or later this can be

   done by using the International Control Panel).

NOTE: If you are using a version of the Macintosh operating system

prior to System 7.1, the date format can not be modified, and the time

can only be changed between a 12 and 24 hour clock by using the

General Control Panel.

Macro Code to Change the Format

-------------------------------

Visual Basic, Applications Edition:

The following macro code places the current date in the footer in the

"mmmm d yyyy" format.

   ActiveSheet.PageSetup.LeftFooter = Format(Now, "mmmm d yyyy")

Microsoft Excel 4.0 Macro Language:

The following macro code places the current date in the footer in the

"dd-mm-yy" format.

   =PAGE.SETUP(,TEXT(NOW(),"dd-mm-yy"))

   =RETURN()

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided 'as is' and Microsoft does not guarantee that the

following code can be used in all situations. Microsoft does not support

modifications of the code to suit customer requirements for a particular

purpose.

KBCategory: kbusage kbprg kbcode kbmacro

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 3.00 4.00 custom

customized


Excel: How to Work With Serial Dates and Julian Dates

Article ID: Q95078

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0

--------------------------------------------------------------------

Most government agencies and contractors require the use of Julian

dates (that is, the number of days from the first of the year and the

number of days till the end of the year, as printed on most desktop

calendars).

In Microsoft Excel, the following formula will convert a serial number

date to a Julian date:

   =TEXT(Standard_Date,"yy")&TEXT((Standard_Date-

   DATEVALUE("1/1/"&TEXT(Standard_Date,"yy"))+1),"000")

where Standard_Date is the defined name given to the cell that

contains the date to be converted. The entire formula must be entered

in a single cell.

The following formula will convert a Julian date to a standard serial

date in Microsoft Excel:

   =DATE(1900+INT(Julian_Date/1000),1,MOD(Julian_Date,1000))

To calculate the number of days that have transpired since January 1

of the current year, use the following function macro:

     =INT(((NOW()/365.255)-(YEAR(NOW())-1900))*365.255)

To calculate the number of days left in the current year, use the

following function macro:

   =(DATE(1+YEAR(NOW()),1,1)-(DATE(YEAR(NOW()),1,1)))-

    TRUNC(((NOW()/365.255)-(YEAR(NOW())-1900))*365.255)

The following are examples of Julian dates:

   Normal date         Julian date

   -----------         -----------

   Jan-01-1990          90001

   Jan-10-1990          90010

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 3.0 3.00 4.0 4.00 2.x 2.00


Excel: Can't Print Color Headers and Footers

Article ID: Q95478

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

In the Microsoft Excel, you cannot print headers and footers in any color

other than black.

MORE INFORMATION

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

It is possible to print headers and footers in color in earlier versions of

Microsoft Excel. Therefore, if you import a Microsoft Excel version 3.0

file that contains color headers or footers to later versions of Microsoft

Excel, the color disappears from the headers and footers.

MORE INFORMATION

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

In Microsoft Excel version 4.0, there is no option for printing in color

when you choose the Font button in the Header or Footer dialog boxes in

Page Setup. In Microsoft Excel version 5.0, from the File menu, choose Page

Setup and then select the Header/Footer tab. When you choose the Custom

Header or the Custom Footer button, then the Font button, there is no

option for selecting or changing font color.

If you choose Print by choosing the button in the Print Preview screen,

choose the Page Setup button, and then choose the Header or Footer button,

a dialog box appears that includes a drop-down list for colors. Although it

is possible to select a color in this dialog box, the color choice does not

affect the way the header or footer is printed.

Microsoft Excel Version 3.0

---------------------------

In Microsoft Excel version 3.0, you can format headers and footers so

that they are printed in color by setting the Normal style to a color

font. To set the Normal style to a color font, choose the Style

command from the Format menu and redefine the font.

REFERENCE

=========

"User's Guide 1," version 4.0, pages 240, 249, 535

"User's Guide," version 3.0, pages 212-213, 534-536

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 4.0 4.00 4.0a 4.00a 5.0 5.00

printing  plotter


How to Add or Subtract from a Given Time with TIME() and MOD()

Article ID: Q95530

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, time values are represented with serial numbers

ranging from 0 (12:00:00 AM) to 0.999988426 (11:59:59 PM).

To add or subtract any number of hours, minutes, and/or seconds from a

specific time of day, create a table similar to the following:

   A1:   Hours  B1: <enter any integer number here>

   A2: Minutes  B2: <enter any integer number here>

   A3: Seconds  B3: <enter any integer number here>

   A4:    Time  B4: <enter the time of day to subtract from>

   A5:    Less  B5: =TIME(B1,B2,B3)

   A6:  Result  B6: =MOD(B4-B5,1)

   Note: To add the time to a specific time of day, change the formula

   in cell B6 to:

       B6: =MOD(B4+B5,1)

For example, if you wanted to subtract 25 hours and 10 minutes from

12:00 PM, your table would look like the following example:

   A1: Hours    B1: 25

   A2: Minutes  B2: 10

   A3: Seconds  B3: 0

   A4: Time     B4: 12:00 PM

   A5: Less     B5: 1:10

   A6: Result   B6: 10:50 AM

In this table:

 - Hours is the numbers of hours to subtract.

 - Minutes is the number of minutes to subtract.

 - Seconds is the number of seconds to subtract.

 - Time is the initial time that you are subtracting from.

 - Less is the total hours, minutes, and seconds being subtracted.

 - Result is the time value result of the formula.

MORE INFORMATION

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

This formula uses the TIME() function to convert integer numbers to

time values. If you want to add or subtract only hours, set the

minutes and seconds arguments in the TIME() function to 0 (zero).

The MOD() function is used to ensure that the result is a positive time

value. The MOD() function returns the remainder after dividing the

result by 1. Since the remainder is always the same sign as the

divisor, and the possible remainders are from 0 to .99999999, this

always produces a correct time value.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, pages 222, 433, 278

"Microsoft Excel Function Reference," version 2.10, pages 123, 236, 155

"Microsoft Excel Functions And Macros," version 2.21, pages 307-372

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 3.00 4.00 4.00a


Excel: File Saved in WK3 Displays Numbers Incorrectly in 1-2-3

Article ID: Q96379

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

When you open a Microsoft Excel file that has been saved in a WK3 file

format in Lotus 1-2-3 version 3.0 or later, the formula bar will display

all numbers with two or more digits to the right of the decimal point out

to sixteen decimal places.

WORKAROUND

==========

To display the number correctly, save the file in WK1 file format and

reopen it in Lotus 1-2-3.

STATUS

======

Microsoft is researching this problem and will post more information

here in the Microsoft Knowledge Base as it becomes available.

KBCategory: kb3rdparty

KBSubcategory:

Additional reference words: 3.0 3.00 4.0 4.00 4.0a 4.00a 5.0 5.00 many

123 Lotus123 digit


Excel Err Msg: Cannot Open Consolidation Source File

Article ID: Q97617

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, if you use the Consolidate command to consolidate

closed files that are saved in the text, CSV, SYLK, DIF, or dBASE (DBF

2, DBF 3, or DBF 4) file formats, you will receive the following error

message

    Cannot open consolidation source file <filename>

for each file you want to consolidate. This error message will be

followed by the error message:

   No data was consolidated

NOTE: The consolidate feature does work properly with closed files

saved in the normal Microsoft Excel file format or in the Lotus 1-2-3

file formats (WKS, WK1, or WK3).

Workaround

----------

If the source files are formatted in the text, CSV, SYLK, dBASE (DBF

2, DBF 3, or DBF 4), or DIF file formats, open the files before you

run the Consolidation command.

In order for the consolidation feature to work properly on a closed

file, the file must be saved in a Microsoft Excel file format (Normal)

or a Lotus 1-2-3 (WKS, WK1, or WK3) file format.

REFERENCES

==========

"Microsoft Excel Users Guide 1," version 4.0, pages 374-383

"Microsoft Excel Users Guide," version 3.0, pages 328-334

KBCategory: kberrmsg

KBSubcategory:

Additional reference words: 7.00 5.00 3.0 3.00 4.0 4.00 4.0a 4.00a link

alert

combine


Excel: Troubleshooting Font Problems

Article ID: Q97911

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

If you are using screen fonts rather than printer fonts, you may experience

incorrect printer output such as garbled print, truncated text, or missing

characters. These problems may also be caused by specific printer drivers

or incompatibility with a third-party font application.

The following information describes troubleshooting steps that will, in

most cases, resolve font printing problems.

MORE INFORMATION

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

General Troubleshooting

-----------------------

First, ensure that the incorrect font output is visible in print preview.

In many cases, when you see the same incorrect output in print preview,

there is some font problem.

If your worksheet looks correct in print preview, this indicates that

Microsoft Excel is sending the proper output to the printer and that the

printing problem is occurring sometime after Microsoft Windows takes

control of the print job. In this case, follow the steps for

troubleshooting printing problems in the Microsoft Windows operating

environment.

If your worksheet does not look right in print preview, the problem may be

caused by incorrect printer information. To work around this problem, try

changing to another printer driver and then switching back to the driver

that you want to use.

If you are able to preview and print other worksheets with correct output,

your worksheet may be damaged. Try copying your entire worksheet to a new

worksheet and then retry printing:

1. Select the entire worksheet by pressing CTRL+SHIFT+SPACEBAR.

2. From the Edit menu, choose Copy.

3. From the File menu, choose New.

4. From the Edit menu, choose Paste and try to print your document

   again.

Either before or after trying the specific solutions in the sections that

follow, try disabling any third-party soft font applications.

NOTE: Many of the third-party applications created for the Microsoft

Windows operating environment have an enable/disable switch.

In addition, ensure that you are using the printer driver version

appropriate for your version of Microsoft Windows. You can check this

version number by choosing the Printers icon in the Microsoft Windows

Control Panel:

 - In Microsoft Windows 95, click the Start button, point to Settings,

   then click Printers. Click the desired printer with the right

   (secondary) mouse button. Choose the Details tab, and check your

   settings.

 - In Microsoft Windows version 3.1, in the Printers dialog box,

   choose the Setup button and then choose the About button.

   -or-

 - In Microsoft Windows version 3.0, choose the Configure button.

   Next, choose the Setup button. In the Setup dialog box, choose

   About. The About dialog box displays your printer driver

   information.

Text Truncating or Values Converting to Pound Signs (#)

-------------------------------------------------------

If you are experiencing problems with text truncating at the end of a cell

or with values converting to pound signs, your screen fonts are probably

being mapped to a non-exact printer font that may have different metrics.

The column widths in Microsoft Excel are based on the font you have

selected for the Normal Style font. If this font is a screen font and there

is no corresponding printer font, Microsoft Excel "maps" the screen font to

the closest printer font. Because the printer font may be a slightly

different size than the screen font, cell contents that appeared to fit in

the cell as shown on your screen may not fit when mapped to a printer font.

To correct this problem, set your Normal Style font to a printer font or a

TrueType font (Microsoft Windows version 3.1 only):

1. From the Format menu, choose Style.

2. Verify that "Normal" is shown as your Style Name and choose the

   Define button.

3. Clear all of the options in the Style Includes box (except Font) and

   choose the Font button at the bottom.

4. Follow the step below that corresponds to your version of Microsoft

   Excel:

   Microsoft Excel version 3.0

   ---------------------------

   a. Select the Printer Fonts check box. This will display a list of

      fonts available on your printer as well as TrueType fonts (if

      you are using Microsoft Windows 3.1).

   b. Choose one of the listed fonts and an appropriate font size.

   Microsoft Excel version 4.0

   ---------------------------

   a. Choose one of the fonts in the font list box that is preceded by

      a printer symbol or by a double T (Microsoft Windows 3.1

      only)--a double T indicates a TrueType font.

   b. Choose an appropriate font size.

Also, if you have changed the fonts in other cells to something other than

the Normal Style font, change those fonts to a printer or TrueType font.

Missing Characters

------------------

Follow the same troubleshooting steps mentioned in the previous section to

change the Normal Style font (as well as any other fonts applied to the

sheet) to printer or TrueType fonts (Microsoft Windows 3.1 only).

If you are using a TrueType font and a non-PostScript printer such as a

LaserJet or a dot-matrix printer, you can set your TrueType fonts to print

as graphics. This will often resolve problems of missing characters. To do

this, follow the first two steps for the version of Microsoft Excel that

you are using and then follow steps 3 through 5 for both versions.

If you are using Microsoft Excel version 3.0:

1. From the File menu, choose Printer Setup.

2. With your printer selected, choose the Setup button. Choose the OK

   button in the warning message.

If you are using Microsoft Excel version 4.0:

1. From the File menu, choose Page Setup.

2. Choose the Printer Setup button. Choose the Setup button.

Next, in both versions:

3. In the Setup dialog box, choose the Options button.

4. Select the Print TrueType Fonts As Graphics check box.

5. Continue choosing the OK button until you have returned to your

   worksheet.

Garbled or Not Printed Output

-----------------------------

If you are using a third-party soft font application, and your printed

document appears garbled or does not print out, you may need to disable the

soft font application. Directions for disabling the soft font application

appear in the "General" section of this article.

Next, ensure that your Normal Style font is a printer font or a TrueType

font (Microsoft Windows 3.1 only). If you have changed any of the fonts in

your sheet to something other than the Normal Style font, ensure that the

font in those cells is also a printer or a TrueType font.

If your sheet is blank when you view it in print preview and when you print

it, the worksheet may be damaged. Ensure that other sheets print correctly

and copy your worksheet to a new worksheet as described in the "General"

section of this article.

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 4.0a 4.00a 5.0 5.00

tshoot


Excel: Patterned Cells May Not Print to HP LaserJet 4

Article ID: Q98399

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you print a Microsoft Excel document to a Hewlett Packard (HP)

LaserJet 4 printer, cells that contain patterns may not print

correctly if the internal resolution setting on the printer is set to

300 dots per inch (dpi).

Cells formatted with certain options in the Patterns dialog box will

appear correctly on the screen and in print preview, but the patterns

will be omitted from the printed page.

This problem will occur with the HP LaserJet 4/4M PostScript driver

if the resolution setting for the driver is 600 dpi and the internal

resolution setting on the printer is set to 300.

MORE INFORMATION

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

Workaround

----------

To work around this problem, change the resolution setting on the

printer from 300 dpi to 600 dpi:

1. Take the printer off-line.

2. With the MENU key, choose the JOB MENU.

3. With the ITEM key, select the option labeled Resolution=300*

4. Use the PLUS key to toggle the resolution to 600.

5. Press the ENTER key to confirm the change.

The display should now read: Resolution = 600 *.

6. Switch the printer back on-line and resume printing.

REFERENCES

==========

"HP LaserJet 4 And 4M Printers User's Manual," pages 2-26

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 3.0 3.00 4.0 4.00

4.0a 4.00a 5.0 5.00 laser 4


Excel: Working with Time Periods That Exceed 24 Hours

Article ID: Q99349

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

Because of the way Microsoft Excel calculates and displays time, you need

to follow a special procedure to add amounts of time that exceed 24 hours.

NOTE: In Microsoft Excel versions 5.0 and later, you can format the cell

containing the sum formula with "[h]:mm:ss"; Microsoft Excel will

automatically add times beyond 24 hours.

To add times that collectively exceed 24 hours, use the appropriate formula

below.

Decimal Output

--------------

If you want to add times when the total of the times exceeds 24 hours,

use the following array formula:

   =SUM(Range*24)

NOTE: The above formula must be entered as an array formula. To enter a

formula as an array formula in Microsoft Excel for Windows or Microsoft

Excel for OS/2, press CTRL+SHIFT+ENTER. In Microsoft Excel for the

Macintosh, press COMMAND+ENTER. (Additional information on entering an

array formula is available in the Online Help. From the Help menu, choose

Search for Help and type "array formula" in the dialog box. Choose the Show

Topics button to view the available topics.)

Or, enter the following formula as a regular worksheet formula:

   =SUM(Range)*24

NOTE: A cell that contains either of the above formulas should be

formatted in either the General format or in a decimal format, not in a

time format.

Text Output

-----------

If you want to add times when the total of the times exceeds 24 hours,

and if you want the total to appear in the "h:mm" format, use the

following formula:

   =TRUNC(SUM(Range*24))&":"&TEXT(MOD(SUM(Range*24),1)*60,"00")

NOTE: The above formula must be entered as an array formula. To enter

a formula as an array formula in Microsoft Excel for Windows or

Microsoft Excel for OS/2, press CTRL+SHIFT+ENTER. In Microsoft Excel

for the Macintosh, press COMMAND+ENTER.

Text Output in h:mm:ss Format

-----------------------------

The following formula displays the result of the addition of times in

h:mm:ss format as a text string:

   =TRUNC(SUM(Range*24))&":"&TEXT(MINUTE(SUM(Range)),"00")&":"&

   TEXT(SECOND(SUM(Range)),"00")

NOTE: The above formula must be entered as an array formula. To enter

a formula as an array formula in Microsoft Excel for Windows or

Microsoft Excel for OS/2, press CTRL+SHIFT+ENTER. In Microsoft Excel

for the Macintosh, press COMMAND+ENTER.

In all four of the above formulas, Range is either the defined name of a

range that contains the times or the cell reference of the range that

contains your times (for example, A1:A4). The values in the range must

be in the "h:mm" or "hh:mm" format.

NOTE: Later versions of Microsoft Excel have a custom number format for

times greater than 24 hours.

MORE INFORMATION

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

Microsoft Excel uses a serial numbering system to calculate dates and

times. In this system, a single day is equal to 1 unit of time. Since

an hour is equal to 1/24th of a day, the serial number equivalent of

one hour is .041667 (1 day divided by 24 hours in a day). Following

the same logic, the serial number equivalent of one minute is .0006944

(1 day divided by 1440 minutes in a day) and the serial number

equivalent of one second is 1.1574E-05 (1 day divided by 86400 seconds

in a day).

When you add times in Microsoft Excel, the serial number equivalents

of the times are added and the result is displayed in a time format.

However, only the fractional amount of the result (time less than 24

hours) can be displayed in a time format. As a result, your answer may

be incorrect by a multiple of 24 hours. For example, if you add the

following times

   Cell      Time     Serial Equivalent (Days)

   ------    -----    ------------------------

   A1        8:00     0.3333

   A2        9:00     0.375

   A3        10:00    0.4167

   A4        11:30    0.4792

             -----    ------

   Expected

   Total     38:30    1.6042

the expected result is 38:30. However, the result that is displayed is

14:30. This is because only the amount to the right of the decimal

point (.6042) is used by the time format. The amount to the left of

the decimal point (1) is in days, and is therefore not displayed when

a built-in time format is used. When formatted using the h:mm or hh:mm

format, .6042 is displayed as "14:30" (without the quotation marks).

The following two examples use the formulas described in the Summary

section of this article to accumulate times over 24 hours:

Example Using Decimal Output

----------------------------

Using the above example times, if you enter the formula

   =SUM(A1:A4*24)

as an array formula, or the regular formula

   =SUM(A1:A4)*24

you will receive 38.5 as a result. The integer portion of the result, 38,

represents the number of hours; and the fractional portion, .5, represents

the fraction of an hour (.5 * 1 hour = 30 minutes).

You can use this number in other computations, if necessary, but it is

not possible to display this number in an "h:mm" or "hh:mm" format

without using another formula to convert the number into text.

Example Using Text Output

-------------------------

Again using the above sample times, if you enter the formula

   =TRUNC(SUM(A1:A4*24))&":"&TEXT(MOD(SUM(A1:A4*24),1)*60,"00")

as an array formula, you will receive the text string "38:30" as a

result. Although this has the appearance of a number that uses the

"h:mm" format, it is not a number; that is, you cannot perform

computations with this number.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00

accumulate


Excel: LINEST() Function Returning Only One Value

Article ID: Q99639

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.0, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

----------------------------------------------------------------------

SUMMARY

=======

The LINEST() function will return only one value, the slope, when the

formula is entered with one cell selected. To obtain both the slope

and the y-intercept, you must select two adjacent horizontal cells and

then enter the LINEST() formula as an array. The syntax of the

LINEST() formula is

   =LINEST(known_y's,known_x's)

where "known_y's" and "known_x's" are ranges on the worksheet

containing the y-values and the x-values, respectively.

The LINEST() formula must be entered as an array. To enter a formula

as an array use the press CTRL+SHIFT+ENTER in Microsoft Excel for

Windows, or COMMAND+RETURN in Microsoft Excel for the Macintosh.

MORE INFORMATION

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

To return the additional regression statistics, select a range of

cells consisting of  two columns (simple linear regression) and 5 rows

and enter the LINEST() function as an array: press CTRL+SHIFT+ENTER in

Microsoft Excel Windows, or COMMAND+RETURN in Microsoft Excel for the

Macintosh. Refer to the LINEST() section of the Microsoft Excel

Function Reference for an illustration depicting the order in which

the additional regression statistics are returned.

REFERENCES

==========

"Microsoft Excel Function Reference," version 4.0, pages 254-258

"Microsoft Excel Function Reference," version 3.0, pages 138-141

"Microsoft Excel User's Guide 1," version 4.0, pages 153-166

"Microsoft Excel User's Guide," version 3.0, pages 277-289

KBCategory: kbusage

KBSubcategory: kbprb

Additional reference words: 7.00 5.00 2.1 2.10  3.0 3.00 4.0 4.00 4.00a

arrays 1


Excel: Resetting Last Cell Address Fixes Memory/Printing Probs

Article ID: Q100406

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can press CTRL+END to select the last cell in a

cell table or dependency table. In some cases this cell may be well beyond

the actual data in your worksheet. In some cases, this cell may result in

memory or printing problems.

To reset the last cell address, you must clear all information (data and

formatting) from the unused columns and rows of your sheet.

MORE INFORMATION

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

If you are working with a large sheet that contains many formulas or a lot

of formatting, you may experience similar memory problems when you attempt

to copy and paste information.

Workarounds

===========

To work around this problem, do any of the following:

Reset the last cell by deleting excess rows and columns

-------------------------------------------------------

1. Select all rows and or columns that do not include any data by

   selecting the appropriate row and/or column headings.

2. From the Edit menu, choose Clear and select the All option.

3. From the Edit menu, choose Delete.

4. Repeat steps 1-3 for as many columns or rows as is necessary.

5. From the File menu, choose Save As and save the file with another

   name.

6. Close the file and reopen it.

Use the following macro to clear blank cells

--------------------------------------------

WARNING: ANY USE OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK.

Microsoft provides this macro code "as is" without warranty of any kind,

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose.

1. In a macro sheet, enter the following:

      A1: ClearCells

      A2: =ERROR(FALSE)

      A3: =ECHO(FALSE)

      A4: =SELECT.LAST.CELL()

      A5: =ROW(ACTIVE.CELL())

      A6: =IF(ISBLANK(ACTIVE.CELL()),CLEAR(1))

      A7: =IF(AND(ROW(ACTIVE.CELL())=1,COLUMN(ACTIVE.CELL())=1),

           RETURN(),IF(ROW(ACTIVE.CELL())=1,SELECT(OFFSET(ACTIVE.CELL(),

           A5-1,-1)),SELECT(OFFSET(ACTIVE.CELL(),-1,0))))

      A8: =GOTO(A6)

2. Select cell A1 and choose Define Name from the Formula menu. Select

   the Command button and choose OK.

3. Activate the worksheet. Choose Run from the Macro menu and run the

   ClearCells macro.

After the macro has finished running, save the worksheet, close it, and

then reopen it. Your last cell (the cell you get when you press CTRL+END)

should be the last cell that contains data.

CAUTION: This macro will delete ALL cell contents (formats, notes, and

defined names) that do not have a physical entry within the cell.

NOTE: The ERROR(FALSE) and ECHO(FALSE) functions in cells A2:A3 are not

required for this macro to run correctly; however, these functions do

significantly increase performance.

To create an example to try the above procedures, do the following:

1. Open a new Sheet.

2. Create cell entries from A1 to F15.

3. In cell H25, type a number and then clear the value from that cell.

4. From the Formula menu, choose Select Special. When you select the

   Last Cell option and choose OK button, cell H25 is selected.

If you select row number 25 and choose Delete from the Edit menu, and

select column H and choose Delete from the Edit menu. The cell address

remains H25 until you select a cell in the A1 to F15 range and save the

file.

NOTE: If you are using Microsoft Excel version 3.0 or earlier, H25 will

remain the last cell address until you close the file and reopen it. In

versions 4.0a and 5.0, you can Clear All and then Save; it is not necessary

to reopen the file.

REFERENCES

==========

"Function Reference," version 4.0, pages 57, 122, 135, 364

"Function Reference," version 3.0, pages 33, 62, 68, 201

KBCategory: kbusage

KBSubcategory: kberrmsg

Additional reference words: 7.00 3.00 4.00 4.00a erase pointer HOWTO


Excel Err Msg: Can't Do that Command on Nonadjacent Selections

Article ID: Q100715

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you may receive one of the following error messages

when you attempt to copy nonadjacent cell selections:

   Microsoft Excel version 4.0 and later

   -------------------------------------

   Cannot do that command on nonadjacent selections

   -or-

   Microsoft Excel versions 3.0 and earlier

   ----------------------------------------

   Can't do that command on a multiple selection

These error messages will occur when your cell or range selections are in

different columns or different rows. You can, however, copy and paste

nonadjacent ranges without an error message if your selection contains any

of the following:

 - Multiple rows within the same column, for example, A1,

   A3, A5,

 - Multiple columns within the same row, for example, A2, C2, E2

   -or-

 - Multiple rows and columns within the same columns and rows, for

   example, A1, C1, A3, C3, A5, C5.

This feature is by design.

NOTE: This message also happens if nonadjacent sheets are selected in a

Microsoft Excel 5.0 workbook and you are pasting to another workbook.

MORE INFORMATION

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

When you make a nonadjacent selection and then choose Copy from the Edit

menu, Microsoft Excel tries to identify an outline type of the selection.

Since Microsoft Excel "slides" the ranges together and pastes them as a

single rectangle, a contiguous rectangle must remain if the rows and

columns in between the selected cells are collapsed or set to a size of 0.

For example if you wanted to perform an operation on the following

sample data,

   A1: 1   B1:     C1: 2

   A2:     B2:     C2:

   A3: 3   B3:     C3: 4

since a contiguous rectangle remains if you were to collapse row 2 and

column B, you can individually select cells A1, C1, A3, C3 and copy them

without error. (To make a nonadjacent selection, hold down the CTRL key

while selecting additional cells or ranges.)

This selection will be pasted as a single rectangle:

   A5: 1  B5: 2

   A6: 3  B6: 4

However, you cannot add cell B2 to this nonadjacent selection, because

Microsoft Excel cannot determine which direction you want the cells to

slide. For example, B2 could slide between A1 and A3, C1 and C3, A1 and C1

or A3 and C3. This would result in rectangles of varying shapes and sizes;

since there is not a way to designate how you want the rectangle arranged,

Microsoft Excel returns the error message. In this case, the cell range

must be a single selection or the cells must be copied individually.

REFERENCES

==========

"User's Guide 1," page 96

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 4.00 2.1 2.1b 2.1c 2.1d 2.01 2.10

2.10b 2.10c 2.10d 4.00a 3.00 2.2 2.20 2.21 fails errmsg discontiguous


Excel: Links Return #REF Error Value

Article ID: Q100717

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.2 , 3.0 ,4.0, 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when a cell being referenced within a link is moved to

another worksheet, Microsoft Excel does not see that the reference has been

moved. The link behaves as if the cell were deleted and returns a #REF!

error value.

If the cell is moved within the same worksheet, the reference will be

updated as expected. This behavior will also occur if you move cells

on top of the cells being referenced by dragging the new cells over

the referenced cells or by using the Cut and Paste commands.

This situation also applies to workbooks in Microsoft Excel, version

4.0.

This feature is by design of the Microsoft Excel program.

Workaround

----------

To avoid receiving a #REF! error value when dragging or pasting cells

on top of externally referenced cells, use the INDIRECT() function or

the OFFSET() function to reference the cell indirectly. For example,

to reference cell A1 in a worksheet called WORKSHEET1.XLS, use one of

the following formulas:

   =INDIRECT("Worksheet1.xls!A1")

   -or-

   =OFFSET(worksheet1.xls!A1,-1,0)

MORE INFORMATION

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

Steps to Reproduce Situation

----------------------------

1. Create a SHEET1.XLS and SHEET2.XLS.

2. In cell A1 of SHEET1.XLS, type "10" (without the quotation marks).

3. In cell A2, type "=A1" (without the quotation marks).

4. Select cell A1 and choose Cut from the Edit menu.

5. Activate SHEET2.XLS. Select cell A1 and choose Paste from the Edit

   menu.

6. Activate SHEET1.XLS. Cell A2 displays the #REF error value.

If you use the formula =INDIRECT("A1") in cell A2, the #REF error will

not be displayed.

REFERENCES

==========

"User's Guide 1," version 4.0, page 192

"User's Guide," version 3.0, page 160

KBCategory: kbother

KBSubcategory:

Additional reference words: 5.00 2.00 2.01 2.10 2.10c 2.10d 4.00 4.00a 3.00


MSQuery: ODBC Information Not Displayed in Error Messages

Article ID: Q101449

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Query for Windows, version 1.0

 - Microsoft Query for Windows 95, version 2.0

----------------------------------------------------------------------

By default, the error messages in Microsoft Query do not provide much

detail or technical information.

If you want to display more technical detail about Microsoft Query errors,

add the following line to the [Debug] section of the MSQUERY.INI file:

   [Debug]

    Vendor Info = 1

This line instructs Microsoft Query to return the complete ODBC error

messages.

The MSQUERY.INI file is located in your Windows directory and can viewed

and edited in a text editor such as Windows Notepad.

KBCategory: kbusage

KBSubcategory: xlquery

Additional reference words: 7.00 1.00 howto


Excel: Macros to Disable Keyboard Input

Article ID: Q101567

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 4.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, to disable all the keys on the keyboard, set the Visual

Basic for applications DataEntryMode property or use the Microsoft Excel

4.0 macro ENTER.DATA() function.

Note that you can also disable keys on the keyboard with the ON.KEY()

function, but this function will not allow you to disable keys such as the

SPACEBAR or the PLUS SIGN (+).

MORE INFORMATION

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

Sample Visual Basic Procedure

-----------------------------

Microsoft provides examples of Visual Basic for applications procedures for

illustration only, without warranty either expressed or implied, including

but not limited to the implied warranties of merchantability and/or fitness

for a particular purpose. This Visual Basic procedure is provided 'as is'

and Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

This code will turn off keyboard entry for the active sheet only. To turn

keyboard entry back on, press CTRL+D.

'Macro to turn off keyboard entry

Sub KeyboardOff()

   Application.OnKey "^d", "KeyboardOn" 'Sets CTRL+D to activate KeyboardOn

   Application.DataEntryMode = True

End Sub

'Macro to restore keyboard entry

Sub KeyboardOn()

   Application.DataEntryMode = False

End Sub

Microsoft Excel 4.0 Example

---------------------------

The following macro example turns on Data Entry mode. The keystroke

CTRL+D initiates the second macro which turns Data Entry mode off. The

macro assumes that all cells on the worksheet are locked.

 A1: =ON.KEY("^d","DataEntryOff")

 A2: =ENTER.DATA(2)

 A3: =RETURN()

 A4:

 A5: DataEntryOff

 A6: =ENTER.DATA(FALSE)

 A7: =RETURN()

The function ENTER.DATA() turns on Data Entry mode and allows you to

enter data into unlocked cells. This function does not allow you to

enter data into locked cells on the worksheet.

NOTE: You can turn off Data Entry mode by pressing the ESC key. If you use

the number 2 for the logical argument, you will not be able to turn off

Data Entry mode with the ESC key.

MORE INFORMATION

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

For more information about the DataEntryMode property, click the Index tab

in Microsoft Excel version 7.0 Help, type the following text

   DataEntryMode

and then double-click the selected text to go to the "DataEntryMode

property" topic.

REFERENCES

==========

"Function Reference," version 4.0, pages 132-133, 302-303

KBCategory: kbprg kbcode kbmacro

KBSubcategory:

Additional reference words: 4.00 4.00a freeze howto


Excel: Finding Open Applications that are DDE Capable

Article ID: Q102362

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0,

   5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can find which of your currently open applications

are capable of dynamic data exchange (DDE) by using the following macro

function:

   =INITIATE("","")

This function will display a DDE dialog box that will list all of the open

applications and topics to which Microsoft Excel can open a DDE channel.

You can then use other DDE commands such as EXECUTE() and SEND.KEYS() to

control the other application.

In Microsoft Excel version 5.0, you can use the following Visual Basic for

Applications procedure to determine which of your open applications are

capable of DDE:

   SUB Initiate_DDE ()

       ChanNum = Application.DDEInitiate("", "")

   End Sub

NOTE: Microsoft Excel for the Macintosh requires system software version

7.0 or later for this and other DDE functions to work.

REFERENCES

==========

"Function Reference," version 4.0, page 240

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 3.0 3.00 4.0 4.00

4.00a 5.0 5.00


Excel: Defined Names Are Not Deleted Dynamically

Article ID: Q102944

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can define a name to refer to a cell range, a

command macro, a custom function, a variable or a constant. If you then use

a different name to refer to the same element, the previous name will not

be deleted.

To remove a previously defined name that you no longer use:

Version 5.0 and later

---------------------

1. Choose Name from the Insert menu.

2. Select Define and select the name you want to remove, choose the

   Delete button, and then choose OK.

Version 4.0

-----------

1. Choose Define Name from the Formula menu.

2. Select the name you want to remove, choose the Delete button, and

   then choose OK.

A similar situation occurs when you use the REGISTER() function in a

macro to register a dynamic link library (DLL) or code resource. If

you specify a name for the function_text argument, this name is added

to the Paste Function and Define Name dialog boxes. If you then run

the REGISTER() function again with a new function_text argument, the

previous name will remain and the new one will be added.

To properly remove a registered function, first use the UNREGISTER()

function to free the memory that is allocated to it. Since

UNREGISTER() does not remove the name from the Paste Function or

Define Name dialog boxes, you must manually delete it from the Define

Name dialog box.

REFERENCES

==========

"Online Help," version 5.0

"Function Reference," version 4.0, page 350-351, 442-443

KBCategory: kbusage

KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 3.00

4.0 4.00 4.0a 4.00a 5.0 5.00 howto


Excel: XLM Macro to Delete Blank Rows Within a Range

Article ID: Q103022

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for the Macintosh, version 2.x, 3.0, 4.0

----------------------------------------------------------------------

SUMMARY

=======

If you have a column of data in Microsoft Excel and you want to delete

the entire row whenever there is a blank in that column, you will have

to use a macro.

MORE INFORMATION

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

This article offers two macro solutions. The first macro, Column_Del,

operates on all of the data in a given column. It determines what your data

range is, selects each cell in the range, and wherever it finds a blank

cell it deletes the corresponding row. Before you run the macro, select the

cell in the column where you want the testing for blank cells to begin.

The second macro, Range_Del, operates only on the range that you select.

Each cell is selected in this range and wherever it finds a blank cell, the

corresponding row is deleted. Use this macro when you have other sections

of data in your column in which you don't want the blank rows deleted.

Before you run the macro, select the range in which you want to have the

blank rows deleted.

NOTE: To define the macro, select cell A1 and from the Formula menu choose

Define Name and choose the radio button for Command. Choose the OK button.

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose.

Column_Del

----------

A1:  Column_Del

A2:  =SELECT("r[-1]c")

A3:  =IF(ISBLANK(ACTIVE.CELL()),SELECT.END(3))

A4:  Last_Row=ROW(ACTIVE.CELL())-1

A5:  =SELECT("r1c")

A6:  First_Row=ROW(ACTIVE.CELL())

A7:  =FOR("counter",First_Row,Last_Row)

A8:  =  IF(ISBLANK(ACTIVE.CELL()))

A9:  =    EDIT.DELETE(3)

A10: =  ELSE()

A11: =    SELECT("r[1]c")

A12: =  END.IF()

A13: =NEXT()

A14: =RETURN()

Description of macro code above:

A1:  Macro name

A2:  Selects one cell up, which moves the active cell to row 16384

A3:  If row 16384 is blank, select end up, which takes you to the

     last cell containing data within the column

A4:  Sets the variable Last_Row equal to the last row of data minus one

A5:  Selects the starting row. (Can be changed to wherever you want to

     start.)

A6:  Sets the variable First_Row to the starting row.

A7:  Sets a FOR Loop which goes from First_Row to Last_Row

A8:  Checks to see if the active cell is blank

A9:  Deletes the entire row (the active cell will move to next row!)

A10: Else if active cell is not blank

A11: Select the next cell below the active cell

A12: Ends the IF Statement

A13: Ends the FOR Loop

A14: Ends the macro

The last cell in the starting column is selected when the macro ends.

Range_Del

---------

A1:  Range_Del

A2:  rows=ROWS(SELECTION())

A3:  =FOR("counter",1,rows)

A4:  =SELECT(ACTIVE.CELL())

A5:  =  IF(ISBLANK(ACTIVE.CELL()))

A6:  =    EDIT.DELETE(2)

A7:  =  ELSE()

A8:  =    SELECT(OFFSET(ACTIVE.CELL(),1,0))

A9:  =  END.IF()

A10: =NEXT()

A11: =RETURN()

Description of Macro Code above:

A1:  Macro name

A2:  Sets a variable name "rows" equal to the number of rows in

     the selection.

A3:  Sets a counter variable that will loop through the macro

     for as many rows there are in the selection.

A4:  Selects the first cell in the range.

A5:  Tests to see if the cell is blank.

A6:  If it is blank, the row is deleted.

A7:  If it is not blank, the next command is executed.

A8:  The next cell in the range is selected.

A9:  Ends the IF() loop.

A10: Repeats the loop going back to A3.

A11: Ends the macro.

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q110759

   TITLE     : XL: Visual Basic Example to Delete Blank Rows

REFERENCES

==========

"Function Reference," version 4.0, pages 6, 124, 227-228, 248, 378-382

"Function Reference," version 3.0, pages 3-4, 63, 126-127, 135-136,

209-210, 212

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00


Excel: How to Use AutoSum in a Macro

Article ID: Q103164

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, there is no macro function to emulate the behavior of

the AutoSum tool. However, you can activate this tool from a macro by using

the SEND.KEYS() function to send the appropriate keyboard shortcut

(ALT+EQUAL SIGN (=)) to start the AutoSum tool.

MORE INFORMATION

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

Microsoft Excel version 5.0 and later

-------------------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Sub AutoSum()

'This macro activates the AutoSum function on the active cell.

     Application.SendKeys ("%=~")

End Sub

Microsoft Excel 4.0

-------------------

The following macro activates the AutoSum function in the active cell:

   A1:   =SEND.KEYS("%=")

   A2:   =SEND.KEYS("~")

   A3:   =RETURN()

Explanation of Above Macro

--------------------------

   A1:   Sends the AutoSum Keyboard Shortcut

   A2:   Sends the Enter Key

   A3:   Ends the macro

Microsoft provides macro examples for illustration only, without

warranty either expressed or implied, including but not limited to the

implied warranties of merchantability and/or fitness for a particular

purpose.

REFERENCES

===========

"User's Guide 1," version 4.0, pages 152, 556

"Function Reference," version 4.0, page 385

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 4.00 4.00a sum end row column formula


XL: Chart Windows Appear Different in Version 5.0

Article ID: Q104299

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

When you create a chart as a new sheet in Microsoft Excel 5.0, the chart

will appear in a view similar to print preview. (To create a new chart,

select the desired data on your sheet, choose the Chart command from the

Insert menu, and then choose As New Sheet.) This view shows how the layout

of your chart and all of its elements will look when you print it. In this

view, you can size, move, and format the plot area (the region bounded by

the axes) and chart items such as graphic objects, titles, text boxes, and

the legend.

This article discusses how options in Page Setup affect what you can move

and size in this view and how to change the view so that the chart fills

the window.

MORE INFORMATION

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

How Options in Page Setup Affect What

You Can Move and Size in the Chart Window

-----------------------------------------

The way the chart window appears on your screen and when you print it

depends on how you set various options in the Page Setup dialog box (these

options include paper size, orientation, and margin size). For example, if

the page orientation is set to Landscape, the window appears wider than it

is tall.

How this chart window appears on screen and when printed depends on the

settings you select in the Page Setup dialog box for items such as paper

size, orientation, and margin size. For example, if the page orientation is

set to Landscape, the window appears wider than it is tall. The option you

select under Printed Chart Size on the Chart tab in the Page Setup dialog

box affects how you can move and size the chart area, plot area and the

chart elements. When you select the full page option, you can size and move

the plot area but not the chart area. When you select the Scale to Fit Page

or Custom options, you can size both the plot area and the chart area. With

either of these options selected, chart elements such as titles, text boxes

and arrows, will move relative to the chart area.

The following table lists the Printed Chart Size options that are located

on the Chart tab, how they affect the way the chart is displayed and

printed, and how they affect what you can move and size.

With this

option         The chart does this     Moving and sizing

------------------------------------------------------------------

Use Full       Fills the page within   The chart area cannot

Page           the margin settings.   be sized. Chart items

                                       must be individually

                                       sized or moved.

Scale To       Scales to fit the       The chart area can be

Fit Page       page within the         sized either vertically

               margin settings in      or horizontally but not

               terms of width          both. Chart items move

               or height               relative to the chart

               (depending on the       area.

               orientation of your

               chart).

Custom         Adjusts to any size     The chart area can be

               or placement within     moved and sized

               the margin settings.   vertically and

                                       horizontally. Chart

                                       items move relative to

                                       the chart area.

How to Change the View So That the Chart Fills the Window

---------------------------------------------------------

The chart window is zoomed in to display your entire chart area. To

view the chart in its full size on your screen, do either of the

following:

 - Choose Zoom from the View menu, select 100% under Magnification,

   and choose OK.

   -or-

 - Select 100% in the Zoom box on the Standard toolbar.

To display the chart as it would appear in Microsoft Excel 4.0 (that is,

with its size determined by the size of the window), choose Sized With

Window from the View menu. This will only affect the active chart. To make

this change for every new chart that you create:

1. From the Tools menu, choose Options.

2. Select the Chart tab and select the Size With Window option.

Note that when you open a Microsoft Excel 4.0 chart in version 5.0, this

option will be selected by default. To display the chart in page layout,

clear this option.

REFERENCES

==========

"User's Guide," version 5.0, Chapter 15, "Creating a Chart"

"User's Guide," version 5.0, Chapter 18, "Formatting a Chart"

Microsoft Excel Help, "Overview of Creating a Chart"

Microsoft Excel Help, "Overview of Changing Colors, Patterns, Borders,

Text, and Numbers"

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: How Pivot Tables Differ from Version 4.0 Crosstab Tables

Article ID: Q104309

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel versions 5.0 and later, you can use pivot tables to

quickly summarize large amounts of data as well as analyze and display it

using calculation methods and formats that you choose. In version 4.0, the

Crosstab add-in provided similar functionality though it was less easy to

use and edit, and it did not provide custom format options. In pivot tables

you can "pivot" your row and column headings around the core data to get a

different view of your source data.

While pivot tables provide more features, power, flexibility, and ease

of use, there are five features available in crosstab tables that are

not available in pivot tables. The following is a list of these five

features:

 - In a crosstab table, you can use the same field for both your row

   heading and your column heading. Pivot tables will not use the same

   field for both headings; if you attempt to do this, the column

   heading will be ignored.

 - When a criteria range is defined on a worksheet, the crosstab table

   will include only the data that meets the criteria. A pivot table

   will use all of the data in a list, ignoring any ranges named

   "criteria" or the result of an AutoFilter. To create a pivot table

   from selected records in database, use the Advanced Filter to

   copy the result set to a different location and specify a criteria

   range. Then, create the pivot table from the result.

 - With the Crosstab command, you have the option to total all of the

   data in the database or total only the data in the crosstab table.

   Totals in pivot tables include all of the data in the pivot table

   view.

 - When you create a crosstab table, an outline is created on

   the sheet so that you can display different levels of detail

   in your data. When you create a pivot table, an outline is

   not automatically created and you won't be able to apply an

   outline to the table.

 - With the Crosstab command, you can disable the double-click drill

   down feature that displays supporting data when you double-click a

   cell. You cannot disable this option in a pivot table; whenever you

   double-click a cell in the table, the supporting data is displayed.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Non-Excel 5.0 Documents Take a Long Time to Open and Save

Article ID: Q104310

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Excel version 5.0 uses the "shared formulas" method for

storing repeated formulas. If your worksheet contains many similar

formulas, this storage method may decrease the size of your file. As a

result, these files take less room on your disk and require less

memory when they're open. In addition, it may take less time for a

file to open, for a sheet to be recalculated, or for cell references

to be adjusted (for example, when you insert a row or column). Note

that these file size improvements and performance enhancements may be

imperceptible if your sheet does not contain many formulas or does not

contain formulas with repeated information.

When you open files created in versions of Microsoft Excel earlier

than 5.0, or files that are in external file formats, the formulas in

these files are converted to shared formulas. This conversion process

results in a slight increase (5-percent to 15-percent) in the amount

of time that it takes to open the file. However, once you save the

file in the Microsoft Excel 5.0 file format (in the Save As dialog

box, choose Microsoft Excel Workbook under Save File As Type), the

file will load and save faster and will require less disk space.

Example of Performance Enhancement

----------------------------------

Following is an example of the performance enhancement provided by

this new feature. Note that the time it takes to load and save a file

will vary depending on the way your computer is configured.

If cells A1:CZ100 of a Microsoft Excel 4.0 worksheet contain the

following formula

   =IF(B125>0.5,B124/B125,B124)

when you save this file, it requires 681,790 bytes of disk space. When

you close and reopen this file in Microsoft Excel 4.0, it takes 16

seconds to open. When you load this file in Microsoft Excel 5.0, it

takes 22 seconds to load. However, when you save this file as a

Microsoft Excel 5.0 Workbook, the file size shrinks to 345,600 bytes

and when you close and reopen this file, it takes 6 seconds to load.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


Excel: DDE Links to Microsoft Access Not Updated Automatically

Article ID: Q104440

-------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0,

   5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

-------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use dynamic data exchange (DDE) to import

Microsoft Access 1.x or 2.0 data, the DDE links will not be updated when

changes are made to the source data.

CAUSE

=====

This situation occurs because Microsoft Access does not support hot links.

WORKAROUND

==========

To update a Microsoft Access link, do the following:

1. In the Microsoft Excel document that you want to update, choose

   Links from the File menu.

2. In the Links list box, select the link or links to be updated.

3. Choose the Update button.

   NOTE: Your data will change to #N/A until you complete step 4

   below.

4. Choose the Close button.

The Microsoft Access data will be correctly updated assuming that Microsoft

Access is installed on your computer and the directory where Microsoft

Access is located is included in the PATH statement of your AUTOEXEC.BAT

file.

MORE INFORMATION

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

The easiest way to use DDE is to create a paste link between Microsoft

Access and Microsoft Excel. To do this, use the following steps:

1. In the Microsoft Access Database window, highlight the table you

   want to link to Microsoft Excel.

2. From the Microsoft Access Edit menu, choose Copy.

3. From the Microsoft Excel Edit menu, choose Paste Link. The formula

   resulting from the Paste Link command should look like the

   following example:

      {=MSAccess|'NWIND.MDB;Table <Customers'>!All}

   where <Customers> is the name of the table you copied.

   NOTE: Microsoft Excel cannot read the default Access .MDB file

   format directly.

STATUS

======

This is expected behavior of Microsoft Access and Microsoft Excel.

REFERENCES

==========

"User's Guide 2," version 4.0, pages 126-132

"User's Guide," version 3.0, pages 338-344

KBCategory: kbinterop

KBSubcategory:

Additional reference words: 7.00 3.0 3.00 4.0 4.00 4.0a 4.00a OLE


Excel: Fields Truncated When File Is Saved in .DBF Format

Article ID: Q104441

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

If a Microsoft Excel document contains a database with more than 128

columns and you save the file in dBASE file format, you may only save

the first 128 columns of the database. When you close and reopen the

file, the columns after the 128th column will be missing.

CAUSE

=====

This situation occurs because the .DBF file formats will only support

a maximum of 128 fields per record in .DB3 or .DB4, and 32 fields per

record in .DB2.

The number of columns that are saved depends on your version of

Microsoft Excel as well as the version of dBASE that the file is saved

in. Based on your version of Microsoft Excel or dBASE, all of the

columns of data may be saved, 32 of the columns may be saved, 128

of the columns may be saved, or 255 of the columns will be saved. The

following table shows how many columns of data will be saved when the

database is saved in various .DBF file formats:

    Version

    of Excel         Platform     File Type     Number of Columns

    -------------------------------------------------------------

    All              All          DBF2               32

    All              All          DBF3              128

    4.0              Windows      DBF4              128

    4.0              Macintosh    DBF4              255

    4.0a             Windows      DBF4              255

    5.0              Windows/NT   DBF4              255

    5.0a             Macintosh    DBF4              255

    5.0c             Windows      DBF4              255

    7.0              Windows 95   DBF4              255

WORKAROUND

==========

To retrieve a dBASE IV file with more than 128 fields in Microsoft

Excel for Windows version 4.0: open the file in Q+E, and then save it

as a Microsoft Excel file. When you subsequently open the file in

Microsoft Excel, all fields are intact.

To export a database to the dBASE format: save the database as a

Microsoft Excel file, open it in Q+E, and then save the file as a

dBASE file (DB4 format).

REFERENCES

==========

"User's Guide 1," version 4.0, pages 57-63

"User's Guide," version 3.0, pages 129-136

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 3.00 4.0a 4.00a 5.00 5.00c


XL: Macro Error Using Menu Customizing Function Commands

Article ID: Q104493

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

When you run a Microsoft Excel 4.0 macro that deletes a custom menu or

command from the worksheet, macro sheet, or chart menu bar, you receive the

following macro error:

   Command or menu does not exist.

CAUSE

=====

This behavior occurs when you run a macro that contains one of the menu

function commands such as DELETE.COMMAND, if the command uses the bar_num

argument with the value 1 or 2.

In Microsoft Excel 5.0, you can display either version 4.0 or version 5.0

menus. Because in Microsoft Excel 4.0, bar 1 refers to the standard menu

bar for sheets and bar 2 refers to the chart menu bar, in version 5.0, 1

and 2 remain the identifiers for the version 4.0 menus. In Microsoft Excel

5.0, bar 10 refers to the standard menu bar for worksheets and macro sheets

and bar 11 refers to the chart menu bar.

The ADD.MENU() and ADD.COMMAND() macro functions add menus and commands to

the menu bar you specify for the bar_num argument. If you specify 1, the

menu or command is also added to bar 10; if you specify bar 2, bar 11 is

updated. When you add a command to a menu that only exists in Microsoft

Excel 4.0, the command will be added to the version 5.0 menu that is in the

same position as the version 4.0 menu. This means that you can run a

version 4.0 customizing macro in Microsoft Excel 5.0 without having to use

version 4.0 menus.

The DELETE.MENU() and DELETE.COMMAND() macro functions remove menus and

commands from the menu bar you specify with the bar_num argument. However,

when you use one of these functions to delete the custom menu or command

from bar 1 or 2, the menu or command is not similarly deleted from bar 10

or 11. Additionally, the command causes a macro error when you are not

using version 4.0 menus. This same problem occurs when you use the

RENAME.COMMAND() and the ENABLE.COMMAND() functions.

WORKAROUND

==========

To avoid receiving a macro error when you run a macro that contains a menu

customizing macro function, use the appropriate bar_num value, 10 or 11 in

the DELETE.MENU(), DELETE.COMMAND(), RENAME.COMMAND() or the

ENABLE.COMMAND() function, to remove a menu or command from the version 5.0

menu bar. If you are removing a command from a menu that exists in 4.0 and

not in version 5.0, you must specify the version 5.0 menu to which the

command was added either by name or by position number.

Although you can run a version 4.0 macro that adds a command or menu in

Microsoft Excel 5.0 without having to use version 4.0 menus, the best

solution is to revise all of your customizing commands to work with version

5.0 menu bars.

MORE INFORMATION

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

For more information about Microsoft Excel Macro Functions, do the

following:

1. Choose Contents from the Help menu.

2. Select Reference Information from the Microsoft Excel Help Contents

   screen.

3. Select Microsoft Excel Macro Functions from the Reference Information

   screen.

4. Select Alphabetical List Of Macro Functions or Macro Functions Listed

   by Category from the Microsoft Excel Macro Functions Contents screen.

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Square Bracket Notation Is Less Efficient Than Tunneling

Article ID: Q104502

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In the Microsoft Excel Visual Basic Programming System, Applications

Edition (Visual Basic), you can use square bracket notation in some

instances as an alternative to tunneling. For example, you could use

[A1] instead of Range("A1") or [Sheet1!A1] instead of

Sheets("Sheet1").Range("A1"). Using this abbreviated notation may take

less time to enter as part of your procedure, but it takes longer to

evaluate these statements at run-time. In addition, it is less

flexible since you can't use variable names inside the square

brackets.

MORE INFORMATION

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

Visual Basic goes through the following steps when it evaluates

statements that use square bracket notation:

1. Determines if the content is a module name.

2. Determines if the content contains a range or object.

3. Calls the EVAL() function which evaluates the contents as

   though it were a cell.

Depending on the size and function of your macro, this process may or

may not have a noticeable affect on its efficiency. If you want to

optimize your macro, use the longer tunneling notation instead.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00


Excel: How the Current Mode of Calculation Is Determined

Article ID: Q104695

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, all currently open documents, except add-in macro

sheets, use the same mode of calculation, regardless of the mode in

which they have been saved.

MORE INFORMATION

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

To help explain how the mode of calculation is determined, this

article refers to the following hypothetical documents:

                                               Saved with this

   Filename      Type of document              mode of calculation

   -----------------------------------------------------------------

   AUTO1.XLS     Worksheet                     Automatic

   MANUAL1.XLS   Worksheet                     Manual

   AUTO1.XLM     Macro sheet                   Automatic

   ADDIN.XLA     Add-in macro sheet            Automatic

   WORKBOOK.XLW  Multisheet Workbook           Automatic

The following statements apply to calculation modes in Microsoft

Excel:

1. The first document you open uses the calculation mode with which it

   was last saved: subsequently opened documents use this same mode.

   For example, if you first open AUTO1.XLS and then open MANUAL1.XLS,

   both documents will use automatic calculation (the mode used by

   AUTO1.XLS). If you open MANUAL1.XLS first and then open AUTO1.XLS,

   both documents will use manual calculation.

2. Changing the calculation mode of one open document changes the mode

   for all open documents.

   If AUTO1.XLS and AUTO1.XLM are both open, changing the calculation

   mode of AUTO1.XLM to manual also changes the mode of AUTO1.XLS to

   manual.

3. All sheets contained in a workbook use the same mode of

   calculation.

   If WORKBOOK.XLW contains a worksheet and a macro sheet, changing the

   calculation mode of the worksheet to manual also changes the

   macro sheet's calculation mode to manual.

4. If all other documents are closed and you create a new document,

   the new document will use the same calculation mode as the

   previously closed documents. However, if you use a template, the

   mode of calculation will be the mode specified in the template.

5. Add-in macro sheets do not affect the calculation mode of other

   documents.

   If ADDIN.XLA is open and has its calculation mode set to automatic,

   opening MANUAL1.XLS will switch the calculation mode to manual,

   even though an automatic document (ADDIN.XLA) is already open.

   The exception to this rule applies if the add-in appears in the

   Unhide dialog box (to unhide a document, press the SHIFT key and

   choose Open from the File menu), in which case the add-in follows

   the same rules as other types of documents.

Controlling the Mode of Calculation

-----------------------------------

Because open documents all use the same mode of calculation, you will

need to follow special procedures when you want to work with documents

that use different calculation modes. For example, if you are working

with AUTO1.XLS and you want to open MANUAL1.XLS in manual calculation

mode, do either of the following:

 - Set AUTO1.XLS to manual calculation mode before you open

   MANUAL1.XLS

   -or-

 - Close AUTO1.XLS (and any other open documents) before you open

   MANUAL1.XLS

MORE INFORMATION

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

There are three modes of calculation in Microsoft Excel: automatic,

automatic except tables, and manual.

   For this mode          Recalculation Occurs When

   ------------------------------------------------

   Automatic              Any change is made to the document. All

                          affected parts of the document are

                          recalculated.

   Automatic              Any change is made to the document. All

   except tables          affected parts of the document EXCEPT TABLES

                          are recalculated. A table is recalculated

                          only when a change is made to it.

   Manual                 You specifically force recalculation.

Recalculating the Active Document

---------------------------------

To recalculate the active document:

 - Press SHIFT+F9 (all versions of Microsoft Excel)

  -or-

 - Press COMMAND+SHIFT+= (Macintosh only)

  -or-

 - Select the Calc Document option in the Calculation dialog box

   (Microsoft Excel 4.0 only)

Recalculating All Open Documents

--------------------------------

To recalculate all open documents, do any of the following:

 - Press F9 (all versions of Microsoft Excel)

  -or-

 - Press CTRL+= (Windows and OS/2 only)

  -or-

 - Press COMMAND+= (Macintosh only)

  -or-

 - From the Options menu, choose Calculate Now (Microsoft Excel 3.0

   only)

  -or-

 - Choose the Calc Now button in the Calculation dialog box (Microsoft

   Excel 4.0 only)

Changing the Mode of Calculation

--------------------------------

1. From the Options menu, choose Calculation.

2. In the Calculation section of the dialog box, select the desired

   calculation mode (automatic, automatic except tables, or manual).

REFERENCES

===========

"User's Guide 1," version 4.0, pages 167-174, 565

"User's Guide," version 3.0 for Windows and OS/2, pages 38-40

"User's Guide," version 3.0 for Macintosh, pages 33-35

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 3.00 4.00  4.00a 5.00 xl5


XL: Double-Clicking Control Activates Default Button

Article ID: Q104936

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In custom dialog boxes in Microsoft Excel,double-clicking an option button

or an item in a standard list box will activate the default button if one

has been set.

If you don't want the default button to be activated when you

double-click an option button or an item in a standard list box, you

must turn off the Default attribute for all of the buttons in the

dialog box. The following steps describe how to do this:

1. Select any button in the dialog box.

2. On Format menu, click Object.

3. Click the Control tab.

4. Clear the Default check box and click OK to accept the change.

5. Select the Default check box and click OK to accept the change.

6. On the Format menu, click Object again.

7. Select the Control tab.

8. Clear the Default check box and click OK to accept the change.

The default button in the dialog box is disabled.

MORE INFORMATION

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

When you create a custom dialog box in Microsoft Excel, one button in the

dialog box may be set as the default button. The default button is

surrounded by a thicker, darker border than other buttons, and is

special in that if you press the ENTER key, the default button will be

activated if no other button currently has the focus.

To set a button to be the default button:

1. Select the button that you want to be the default button.

2. On the Format menu, click Object.

3. Select the Control tab.

4. Select the Default check box.

5. Click OK to accept the change.

Note that only one button in a dialog box can be the default button.

If you set a button to be the default button, double-clicking an option

button or an item in a standard list box will activate the default button,

just as if you had pressed the ENTER key. You cannot activate the default

button by double-clicking a check box, edit box, spin control, or scroll

bar, or by selecting an item in drop-down list.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 visual basic focus


XL: Macros to Sort Tabs in the Active Workbook

Article ID: Q105069

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

Although there is no built-in tool to alphanumerically sort sheets,

charts, modules, Microsoft Excel 4.0 macro sheets, and dialog sheets

in a workbook, you can do this with a macro.

MORE INFORMATION

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

The following macro sorts all of the tabs in the active workbook in

ascending order.

Microsoft provides macro examples for illustration only, without

warranty either expressed or implied, including but not limited to the

implied warranties of merchantability and/or fitness for a particular

purpose. This macro is provided as is and Microsoft in no way

guaranties that the following code can be used in all situations and

will not support modifications of the code to suit specific customer

requirements.

To Create the macro

-------------------

1. If you do not have a Visual Basic module sheet in the workbook

   where you would like to store this macro, do the following to add

   one: from the Insert menu, choose Macro, and then choose Module.

2. In the module sheet, enter either of the following macros:

   Sub Sort_Active_Book1()

   Dim i As Integer, j As Integer

   For i = 1 To Sheets.Count

       For j = 1 To Sheets.Count - 1

           If UCase$(Sheets(j).Name) > UCase$(Sheets(j + 1).Name) Then

               Sheets(j).Move After:=Sheets(j + 1)

           End If

       Next j

   Next i

   End Sub

   Sub Sort_Active_Book2()

      Dim Num_Tabs As Integer, Top As Integer

      Dim Small As Integer, Counter As Integer

      Num_Tabs = Sheets.Count

      'Sorts the active book in ascending order using the Selection Sort

      For Top = 1 To Num_Tabs - 1

      Small = Top

      For Counter = Top + 1 To Num_Tabs

         If UCASE$(Sheets(Counter).Name) < UCASE$(Sheets(Small).Name) Then

            Small = Counter

         End If

      Next Counter

      If Small > Top Then Sheets(Small).Move Sheets(Top)

      Next Top

     'Activates the first tab in the active book (optional)

      Sheets(1).Select

   End Sub

   NOTE: If you want to sort the tabs in descending order instead of

   ascending order, change the less-than sign (<) to a greater-than sign

   (>) in the following line:

      If UCASE$(Sheets(Counter).Name) < UCASE$(Sheets(Small).Name) Then

To use the macro

----------------

1. Open the workbook that you want to sort.

2. From the Tools menu, choose Macro.

3. From the list of macros, select the Sort_Active_Book macro and

   choose Run.

The tabs of the workbook will be sorted.

KBCategory: kbprb kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Can't Link Edit Box to Worksheet Cell from Control Tab

Article ID: Q105110

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, although you can establish a link between some types of

dialog box controls and a worksheet cell, edit boxes do not have this

capability. To allow the value of an edit box to appear in a cell, you must

create a Visual Basic procedure.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

The following Visual Basic procedure creates the equivalent of a cell link

between an edit box and cell A1 on a worksheet. In order for the procedure

to run each time you enter new information in the edit box, the procedure

should be assigned to the edit box by choosing Assign Macro from the Tools

menu.

'---------------------------------------------------------------------

Sub EditBox1_Change()

   ' Enter the value contained in the edit box in

   ' cell A1 on Sheet1

   Worksheets("Sheet1").Cells(1, 1).Value = _

      ActiveDialog.EditBoxes("Edit Box 1").Text

End Sub

'---------------------------------------------------------------------

To assign the macro EditBox1_Change to the edit box, do the following:

   1. Select the sheet tab of the dialog sheet that contains your Edit Box.

   2. On the dialog frame, select the edit box, and choose Assign Macro

      from the Tools menu.

   3. From the Macro Name/Reference list, select EditBox1_Change and choose

      OK.

When you run the dialog box, and type text in the edit box and choose OK,

the text is entered in cell A1 on Sheet1. The EditBox1_Change procedure

sets the value of cell A1 equal to the text property of Edit Box 1.

Note that in this example, the name of the edit box is "Edit Box 1" and the

name of the worksheet is "Sheet1". This example assumes that the dialog

sheet that contains the edit box, the Visual Basic module that contains the

EditBox1_Change procedure, and Sheet1 are located in the same workbook.

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, Chapter 11, "Linking

Controls to Worksheets," and "Assigning Code to Controls and Dialog

Boxes"

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 5.00a 5.00c spin scroll button list


XL: "Not Enough Memory" or Computer Hangs with AutoFilter

Article ID: Q105322

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

When you use the AutoFilter command to filter data, the resulting drop-down

list of unique items is limited to 251 identifiers. If the number of unique

identifiers in a list is extremely large, you may receive "Not Enough

Memory" errors or your computer may stop responding (hang).

NOTE: The limit for Microsoft Excel version 7.0 is 250 due to the addition

of one more built-in list item ("Top 10").

KBCategory: kbusage kbtlc

KBSubcategory:

Additional reference words: 7.00 5.00 crash respond limit max maximum drop

down items


XL: Passed Strings Greater Than 255 Characters Are Truncated

Article ID: Q105416

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Macintosh, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you use a Microsoft Visual Basic Programming System,

Applications Edition procedure to pass a string greater than 255 characters

to an object such as a text box, the text is truncated to 255 characters.

CAUSE

=====

This behavior occurs because in Microsoft Excel, you cannot have more than

255 characters per cell. As a result, any strings greater than 255

characters passed from a Visual Basic procedure to any Microsoft Excel-

specific function or object is truncated to 255 characters.

This limit applies to all strings passed from a Visual Basic procedure to a

Microsoft Excel sheet (it is not exclusive to information passed to cells).

For example, if you pass a text string longer than 255 characters to a text

box, either on a worksheet or a dialog sheet, the text is truncated even

though a text box can hold up to 10,240 characters.

WORKAROUND

==========

To insert more than 255 characters in a text box, you can use the

Characters property to insert multiple string variables by using either of

the following examples:

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Example 1

---------

In the example below, the character length of each variable is 100. Each

Insert method inserts another string at the position at the end of the

previous string.

Sub NoLoop()

   Dim var1 as String, var2 as String, var3 as String

   Dim first As Integer, secnd As Integer, third As Integer

   ' Note that each of the strings within quotation marks should be entered

   ' on one line

   var1 = _

      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

   var2 = _

      "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"

   var3 = _

      "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

      cccccccccccccccccccccccccccccccc"

   var4 = _

      "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

      dddddddddddddddddddddddddddddddd"

   'Character length of each variable string is 100 characters

   ' Define variable equal to length of first string

   first = Len(var1) + 1

   ' Define variables equal to length of original string plus

   ' length of each additional string

   secnd = first + Len(var2)

   third = secnd + Len(var3)

   ' Insert first string into text box

   DialogSheets(1).TextBoxes(1).Characters.Insert String:=var1

   ' Insert second string at the location of the end of the first string

   DialogSheets(1).TextBoxes(1).Characters(first).Insert String:=var2

   ' Insert third string at the location of the end of the second string

   ' and so on

   DialogSheets(1).TextBoxes(1).Characters(secnd).Insert String:=var3

   DialogSheets(1).TextBoxes(1).Characters(third).Insert String:=var4

End Sub

Example 2

---------

Sub Loop ()

   Dim i as Integer

   Dim mytxt As String

   ' Assign mytxt variable to the desired string

   ' String should be entered as one line

   mytxt = "this is the desired string longer than 255 characters"

   With DialogSheets(1).TextBoxes(1)

      ' Initialize text in text box

      .Text = ""

      For i = 0 To Int(Len(mytxt) / 255)

         .Characters(.Characters.Count + 1).Insert Mid(mytxt, (i * 255) + _

            1, 255)

      Next

   End With

End Sub

MORE INFORMATION

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

Visual Basic, Applications Edition is an improvement over using the

Microsoft Excel 4.0 macro language in that you CAN use Visual Basic

procedures for parsing, reading, and writing from a file up to 64K in size.

When you use strings in a Visual Basic procedure, you are not limited to

255 characters; if you are using Microsoft Windows version 3.1, you can use

strings up to 64K.

REFERENCES

==========

"User's Guide," version 5.0, page 113

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Not All Toolbars Listed on Popup Menu

Article ID: Q105451

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, not all available toolbars are shown on the

toolbar shortcut menu. This is by design.

MORE INFORMATION

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

To show or hide a toolbar that is not on the toolbar shortcut menu, do

either of the following:

 - From the toolbar shortcut menu, choose Toolbars and then make the

   appropriate changes in the Toolbars dialog box.

   -or-

 - Create a custom toolbar that contains the buttons you want: the custom

   toolbar will be shown on the shortcut menu.

The toolbar shortcut menu provides a quick way to show or hide toolbars,

as well as access to the Toolbars dialog box. To show the toolbar

shortcut menu:

 - In Microsoft Excel for Windows, click the right mouse button on any

  visible toolbar.

 - In Microsoft Excel for the Macintosh, press and hold the COMMAND and

   OPTION buttons and then click any visible toolbar.

The toolbar shortcut menu does not display all available toolbars.

Because of this, you may need to use the toolbars dialog box to show

or hide some toolbars.

The toolbars that are displayed on the toolbar shortcut menu are as

follows:

Microsoft Excel version 5.0 and later

-------------------------------------

   On toolbar shortcut menu               Not on toolbar shortcut menu

   -------------------------------------------------------------------

   Standard                               Query and Pivot

   Formatting                             TipWizard

   Chart                                  Stop Recording

   Drawing                                Full Screen

   Forms

   Visual Basic

   Auditing

   WorkGroup

   Microsoft

   [any custom toolbars you create]

Microsoft Excel version 4.0

---------------------------

   On toolbar shortcut menu               Not on toolbar shortcut menu

   -------------------------------------------------------------------

   Standard                               Stop Recording

   Formatting                             Macro Paused

   Utility

   Chart

   Drawing

   Microsoft Excel 3.0

   Macro

   [any custom toolbars you create]

REFERENCES

==========

"User's Guide," version 5.0, Chapter 34

KBCategory: kbusage

KBSubcategory:

Additional reference words: 4.00 5.00


XL: Defined Names for Print Area or Titles May Not Be Dynamic

Article ID: Q105817

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can enter a defined name in the Print Area and

Print Titles boxes in the Page Setup dialog box (from the File menu, choose

Page Setup). When you do this, Microsoft Excel will remove the name and

replace it with its absolute definition when you close the Page Setup

dialog box.

The only way to create a "dynamic" print area or print titles is to

define the names <Sheetname>!Print_Area and <Sheetname>!Print_Titles

on the worksheet, where <Sheetname> is the name of the worksheet.

Microsoft Excel will automatically use these names in the Page Setup

dialog box.

This is by design.

MORE INFORMATION

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

Steps to Reproduce Behavior

---------------------------

 1. In a new worksheet, select columns A, B, and C.

 2. From the Insert menu, choose Name, and then choose Define.

 3. In the Names In Workbook box, type "TestTitles" (without the

    quotation marks) and choose OK.

 4. Select cells D1:K10.

 5. From the Insert menu, choose Name, and then choose Define.

 6. In the Names In Workbook box, type "TestArea" and choose OK.

 7. From the File menu, choose Page Setup.

 8. Select the Sheet tab.

 9. In the Print Area box, type "TestArea" (without the quotation

    marks). In the Columns To Repeat At Left box, type "TestTitles"

    and choose OK.

10. From the File menu, choose Page Setup.

The Print Area box will now contain the reference $D$1:$K$10 and the

Columns To Repeat At Left box will now contain $A:$C. When you exit

Page Setup, Microsoft Excel replaces the names with their absolute

definitions.

Note that if <Sheetname>!Print_Area and <Sheetname>!Print_Titles have

been defined they will be used automatically.

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 5.00 rows top


XL: Can't Use PrintOut When Custom Dialog Box Is Visible

Article ID: Q105876

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

----------------------------------------------------------------------

SYMPTOMS

========

It is not possible to use the PrintOut or PrintPreview methods (to print a

sheet or view it in print preview) when a custom dialog box is visible.

CAUSE

=====

This problem occurs because of the way in which Visual Basic for

Applications code and custom dialog boxes interact in Microsoft Excel. For

example, to use the PrintOut method to send a document called "Sheet1" to

your printer, you would use the command:

   Worksheets("Sheet1").PrintOut

However, when a custom dialog box is visible on the screen, if your macro

uses the PrintOut method, you may receive the error message:

   PrintOut method of Worksheet class failed

   -or-

   Run-time error '1004':

   Printout Method of sheets class failed

WORKAROUND

==========

To work around this problem, you can use a method called "tunneling" to

remove the dialog box, perform your print action, and redisplay the dialog

box.

To use the PrintOut method, you must first hide or dismiss all custom

dialog boxes.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

This Visual Basic code example uses tunneling to display a dialog box, hide

the dialog box before it prints a worksheet, and then redisplay the dialog

box when the print operation is complete.

This example assumes that you have a dialog sheet (Dialog1) and a worksheet

(Sheet1) that are located in the same workbook. The dialog sheet contains

two buttons: DoneButton and PrintButton.

Before you run the macro, you need to assign the appropriate macros to the

DoneButton and the PrintButton. To do this, follow these steps:

1. Activate the dialog sheet.

2. Select the DoneButton.

3. From the Tools menu choose Assign Macro.

4. Select the DoneButton_Click macro and choose OK.

To assign the PrintButton_Click macro to the PrintButton, repeat steps 1

through 4 and substitute PrintButton for DoneButton and PrintButton_Click

for DoneButton_Click.

To run the example, position the insertion point in the line that reads

"Sub MainMacro()" and press the F5 key.

'-----------------------------------------------------------------------

Option Explicit

Public DoneFlag As Integer, PrintFlag As Integer

Sub MainMacro()

   PrintFlag = 0                         'initialize PrintFlag

   DoneFlag = 0                          'initialize DoneFlag

   'While the DoneFlag does not equal 1 (which will only occur if the

   'DoneButton is clicked), continue to loop through the Subroutine.

   Do

      If PrintFlag = 1 Then              'if the PrintFlag is set, then

         Worksheets("Sheet1").PrintOut   'print Sheet1 and

         PrintFlag = 0                   'reset the PrintFlag

      End If

      DialogSheets("Dialog1").Show       'display the dialog box

   Loop Until DoneFlag = 1               'loop until DoneButton clicked

End Sub

Sub DoneButton_Click()

   DoneFlag = 1                          'set the DoneFlag

   DialogSheets("Dialog1").Hide          'hide the dialog box

End Sub

Sub PrintButton_Click()

   DoneFlag = 0                          'ensure DoneFlag set to 0

   PrintFlag = 1                         'set the PrintFlag

   DialogSheets("Dialog1").Hide          'hide the dialog box

End Sub

'-----------------------------------------------------------------------

When either of the DoneButton or PrintButton buttons are activated, the

appropriate subroutines (DoneButton_Click or PrintButton_Click) are run:

within each subroutine, the Dialog1 dialog box is hidden and a flag

(DoneFlag or PrintFlag) is set to 1. The MainMacro subroutine then resumes

and loops back: if PrintFlag equals 1, the macro prints the worksheet and

redisplays the dialog box; if DoneFlag equals 1, the macro exits the loop

and ends the macro.

In this way, the PrintOut method is only executed if the Dialog1 dialog box

is not visible on the screen, and the dialog box will be redisplayed until

you exit the loop by activating the DoneButton.

KBCategory: kbprint kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 chart fails fail printing runtime run

time


XL: Error Using Data Form If Too Many Fields Are Present

Article ID: Q106206

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you use the Data Form command, there is a

limit to the number of fields that you can edit in a database.

   For Microsoft    If the number  You will receive

   Excel version    of fields is   this error message

   -------------------------------------------------------------------

   7.0              More than 32   Too many fields in the data form.

   5.0              More than 32   Too many fields in the data form.

   4.x              More than 32   Too many fields in the data form.

   4.x              Exactly 32     Dialog box contains too many items.

   3.0              More than 32   Too many fields in the data form.

   2.x              More than 32   Too many fields in data form.

   2.2 (Macintosh)  Exactly 32     Dialog too large.

On page 371 of the "User's Guide," version 5.0, the note at the bottom

of the page implies that you can view the first 32 fields of a

database that contains more than 32 fields. This note may be

misleading. To use a data form with a database that contains more than

32 fields, you must select fewer than 32 fields before you choose Form

from the Data menu.

MORE INFORMATION

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

If you receive any of the above error messages, you will need to do

either of the following:

 - Reduce the number of fields in your database to 31 or 32 (depending

   on your version of Microsoft Excel).

  -or-

 - Edit the database directly on the worksheet.

When you use the Data Form in Microsoft Excel version 5.0, Microsoft

Excel will "wrap" the edit boxes in the Data Form so that all edit

boxes are visible on the screen. Because earlier versions of Microsoft

Excel do not do this, edit boxes in Data Forms in Microsoft Excel

versions 4.0 and earlier may not be visible on the screen--they have

been "pushed" off of the bottom edge of the screen and, therefore, are

not accessible for editing.

For more information about scrolling the data form in Microsoft Excel,

query on the following words in the Microsoft Knowledge Base:

   excel and data and form and screen and resolution and fit and display

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00


XL5: PivotTable Wizard Does Not Automatically Refresh Data

Article ID: Q106243

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel version 5.0, when you change the data or the field

name of a list that is included in a pivot table, and you then start

the PivotTable Wizard, the information in the existing PivotTable will

not be updated unless you choose the Refresh Data command from the

Data menu.

MORE INFORMATION

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

You can use the PivotTable Wizard to change the list range, the

arrangement of fields in the page, column, row, or data areas, and the

location of an existing pivot table. However, the PivotTable Wizard

does not automatically refresh the data in the existing pivot table.

To refresh the data, you must choose the Refresh Data command from the

Data menu.

This is by design.

Once you create a pivot table, you can select a cell in the pivot

table and choose the PivotTable command from the Data menu to display

the source information. However, choosing this command does not

automatically refresh the data.

NOTE: Changing the field names in the original list may cause

inaccurate results when the pivot table data is refreshed. To change

field names, choose the PivotTable Field command from the Data menu.

Steps to Reproduce Behavior

---------------------------

 1. In a new worksheet, type the following:

      A1: Name     B1: Age      C1: Dept

      A2: John     B2: 25       C2: 3

      A3: Jane     B3: 34       C3: 6

 2. From the Data menu, choose PivotTable.

 3. In the Step 1 Of 4 dialog box in the PivotTable Wizard, select

    the Microsoft Excel List Or Database option.

 4. In the Step 2 Of 4 dialog box in the PivotTable Wizard, select the

    range A1:C3.

 5. In the Step 3 Of 4 dialog box, move the Name field to the Row area

    and move the Age field to the Data area. Choose the Next button.

 6. In Step 4 Of 4, click cell E1 to place the PivotTable on this

    sheet, and then choose Finish.

 7. Change the value in cell B2 to 10.

 8. Select cell E2 (or any other cell in the pivot table).

 9. From the Data menu, choose PivotTable. In the PivotTable Wizard

    dialog box, choose the Finish button.

    Note that the table is not updated.

10. From the Data menu, choose Refresh Data.

    The PivotTable is updated.

11. Change the contents of cell B1 to "Bogus" (without the quotation

    marks). Then, select cell E2.

12. Repeat step 9.

    Note that the table does not update correctly.

13. Repeat step 10.

    Note that the pivot table does not update to reflect the new

    field name. It is still summing the field "Age" which no longer

    exists. To change a field name, re-create the pivot table or

    choose the PivotTable Field command from the Data menu.

REFERENCES

==========

"User's Guide," version 5.0, Chapter 25

For more information about customizing Pivot Tables, choose the

Search button in Help and type:

   pivot tables, customizing

KBCategory: kbusage kbtlc

KBSubcategory:

Additional reference words: 5.00 database list 7.00


XL: Multiple Sheets Inserted with Autotemplate

Article ID: Q107545

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you save a file as an autotemplate, all of the

sheets in the file, not just the first sheet, are saved in the

autotemplate. As a result, if you insert the autotemplate into an open

workbook, more than one sheet may be inserted.

To avoid this situation, remove all sheets but one before you save the

autotemplate.

For example, before you save a workbook as an autotemplate called

SHEET.XLT, remove all sheets but one worksheet from the workbook (that is,

MODULE.XLT would contain only one Visual Basic module, DIALOG.XLT would

contain only one dialog sheet, and so on).

MORE INFORMATION

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

In Microsoft Excel, you can create a special type of file called an

autotemplate. Autotemplates are template files that have been saved into

your EXCEL\XLSTART directory with the following names:

                        Save File in startup

   Sheet type           directory as

   -----------------------------------------

   Worksheet            SHEET.XLT

   Chart                CHART.XLT

   Module               MODULE.XLT

   Dialog               DIALOG.XLT

   MS Excel 4.0 Macro   MACRO.XLT

In Microsoft Excel for the Macintosh, the files are saved in the

'System Folder:Preferences:Excel Startup Folder (5)' folder with the

following names:

Worksheet            Worksheet

Chart                Chart

MS Excel 4.0 Macro   Macro

Module               Module

Dialog               Dialog

For more information on replacing the default module with an autotemplate,

query on the following words in the Microsoft Knowledge Base:

   replace and default and module and autotemplate

To save a file as an autotemplate:

1. From the File menu, choose Save As.

2. In the Save As dialog box, under Save File As Type, select Template.

3. In the Directories list box, switch to the EXCEL\XLSTART directory.

4. Type the appropriate filename from the list above into the File Name

   box.

5. Choose OK to save the autotemplate.

6. From the File menu, choose Close to close the autotemplate file.

When you create an autotemplate, the autotemplate is used in place of

the default sheet when you insert a sheet into a workbook. This

allows you to create custom default settings for all of the sheets that you

use.

REFERENCES

==========

"User's Guide," version 5.0, pages 657-658

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Not All Worksheet Functions Supported As Application

Article ID: Q107564

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In the Microsoft Visual Basic Programming System, Applications Edition, not

all Microsoft Excel worksheet functions are supported as methods of the

Application object.

MORE INFORMATION

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

You can write Visual Basic procedures that call Microsoft Excel worksheet

functions. The worksheet functions that are available to Visual Basic

procedures are in the Application object, and are listed in the

Methods/Properties list for the Application object in the Visual Basic

Object Browser.

Most worksheet functions that are not available as methods of the

Application object have an equivalent Microsoft Visual Basic built-in

operator or function. For example, the Mod() worksheet function is not

available as a method of the Application object because there is an

equivalent Mod operator built-in to Visual Basic. This is by design,

because a Visual Basic operator works faster than a Microsoft Excel

function in a Visual Basic module.

To display a list of all the Microsoft Excel worksheet functions available

as methods of the Application object in Visual Basic, do the following:

Microsoft Excel version 7.0

---------------------------

(The following steps assume that you installed the Visual Basic Help file

during Setup.)

1. Click the Index tab in Microsoft Excel Help, enter "worksheet

   functions, using" (without the quotation marks), and then click Display.

2. In the list of topics, click "List of Worksheet Functions Available to

   Visual Basic" and click Display.

Microsoft Excel version 5.x

---------------------------

1. Click the Search button in Visual Basic Reference Help, type "worksheet

   functions" (without the quotation marks), and click Show Topics.

2. In the list of topics, click Using Worksheet Functions In Visual

   Basic, and click Go To.

To locate the equivalent Visual Basic operator or function of a Microsoft

Excel worksheet function that is not available as an Application object

method, do the following:

Microsoft Excel version 7.0

---------------------------

(The following steps assume that you installed the Visual Basic Help file

during Setup.)

1. Click the Contents tab in Microsoft Excel Help.

2. In the list of topics, click Microsoft Excel Visual Basic Reference, and

   click Open. Click Functions, and then click Open.

3. Click the letter of the operator or function that you want to use, and

   click Open.

4. Click the operator or function with the same name as the function you

   want to use, and click Display.

Microsoft Excel version 5.x

---------------------------

1. Click the Search button in Visual Basic Online Help and type:

      programming language

2. Click Show Topics and choose Go To.

3. Click the operator or function with the same name as the function you

   want to use.

The following table contains worksheet functions that are not available as

methods of the Application object. The Visual Basic Equivalent column lists

functions you can use that will produce the same as or similar to the

results that the functions return.

Microsoft Excel                   Visual Basic

worksheet function                equivalent

------------------------------------------------------------

CHAR()                            CHR function

CODE()                            ASC function

DATE()                            DATESERIAL function

ERROR.TYPE()                      ERR function

EXACT()                           STRCOMP function

INDIRECT()                        No direct equivalent - use Range, Cells,

                                  Offset, or any other way of

                                  referencing cells.

INFO()                            No direct equivalent - use the following:

                                  CURDIR function, the following

                                  Application properties (MEMORYTOTAL,

                                  MEMORYUSED, MEMORYFREE, VERSION,

                                  OPERATINGSYSTEM, CALCULATION, COUNT)

ISBLANK()                         ISEMPTY function

ISREF()                           TYPENAME function

LOWER()                           LCASE function

N()                               No equivalent (none needed)

NA()                              No equivalent - use

                                  ActiveCell.Value = "#N/A"

RAND()                            RND function

SIGN()                            SGN function

SQRT()                            SQR function

T()                               No equivalant (none needed)

TODAY()                           DATE function

TRUNC()                           FIX function

TYPE()                            TYPENAME function

UPPER()                           UCASE function

VALUE()                           VAL function

NOTE: The Microsoft Excel worksheet function and the Visual Basic

equivalent operator or function are not always calculated the same way and

may give different results, even when they have the same name.

Using the Visual Basic equivalent operator or function is preferred for

increased speed and flexibility in calculations. Additionally, the Visual

Basic operator or function is available to all applications that use the

Microsoft Visual Basic Programming System, Applications Edition.

KBCategory: kbprg

KBSubcategory:

Additional reference words: 5.00 5.00c 7.00


XL: How To Add a Sheet After Last Sheet in a Single Action

Article ID: Q107622

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed at the beginning of this article,

it is possible to add a new sheet after the last sheet in the workbook in a

single action by using the Move method in conjunction with the Add method.

MORE INFORMATION

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

If your application requires that a new sheet be added or inserted

after the last sheet in the workbook, use either of the following

procedures:

 - If you manually add the new sheet to the workbook (by choosing the

   appropriate item in the Insert menu, for example), you can drag the new

   sheet's tab to the right of all of the other sheet tabs. This makes the

   new sheet also become the last sheet in the workbook.

   -or-

 - If you are using a Visual Basic subroutine to add the new sheet to the

   workbook, you can use the Move method to move the new sheet to the

   proper location. An example of how to do this is shown below.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

The following Visual Basic code example inserts a new sheet into a workbook

and makes the new sheet become the last sheet in the workbook by moving it

to the right of the rightmost sheet.

This example assumes you have a workbook that contains at least one

Visual Basic module and any number of other sheets.

To run the example, position the cursor in the line that reads

"Sub AddNewSheet()" and either press the F5 key or choose Start from

the Run menu.

'----------------------------------------------------------------------

Sub AddNewSheet()

   Application.ScreenUpdating = False    'prevents screen refreshing

   'This line adds a new worksheet to the workbook and makes it the last

   'sheet in the workbook. Alternatively, you can also use:

   '

   'DialogSheets.Add                    to add a dialog sheet

   'Charts.Add                          to add a chart sheet

   'Modules.Add                         to add a Visual Basic module

   'Sheets.Add Type:=xlExcel4MacroSheet to add a MS Excel 4.0 Macro sheet

   Worksheets.Add.Move After:=Sheets(ActiveWorkbook.Sheets.Count)

   Application.ScreenUpdating = True     'reenables screen refreshing

End Sub

'----------------------------------------------------------------------

When you run the AddNewSheet subroutine, it will add a new sheet to

the active workbook and make the new sheet become the last sheet in

the workbook.

If you try to add a new sheet after the last sheet in the workbook,

without using the Move method, you will receive the error message:

   Add method of Sheet class failed

For example, the following command will return an error message

   Worksheets.Add After:=Sheets(ActiveWorkbook.Sheets.Count)

because it attempts to add a new sheet after the last sheet in the

workbook without using Move.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Disabling Microsoft Excel Control Menu Commands

Article ID: Q107689

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

You can use the Microsoft Windows Dynamic Link Libraries (DLLs) to disable

the commands in the Microsoft Excel Control menu. For example, you can use

these tools to delete the Minimize and Maximize buttons.

MORE INFORMATION

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

Microsoft Excel does not have the built-in functionality to modify the

Control menu commands. However, you can use the Declare statement in a

Visual Basic procedure to call Microsoft Windows functions to disable and

restore Control menu items.

The following example Visual Basic procedure, Disable_Control, disables the

entire Control menu in Microsoft Excel. The macro disables the Control menu

for the current session of Microsoft Excel (when you restart Microsoft

Excel the Control menu will be reset). The procedure RestoreSystemMenu

restores the Control menu.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

MICROSOFT EXCEL VERSION 7.0

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

Declare Function GetActiveWindow Lib "User32" () As Integer

'Enter the following Declare statement as a single line

Declare Function GetSystemMenu Lib "User32" (ByVal hWnd As Integer, ByVal

bRevert As Integer) As Integer

'Enter the following Declare statement as a single line

Declare Function DeleteMenu Lib "User32" (ByVal hMenu As Integer, ByVal

nPosition As Integer, ByVal wFlags As Integer) As Integer

'The following procedure disables the Control menu

Sub Disable_Control()

   Dim X As Integer

   For X = 1 To 9

      'Delete the first menu command and loop until

      'all commands are deleted

      Call DeleteMenu(GetSystemMenu(GetActiveWindow, False), 0, 1024)

   Next X

End Sub

'The following procedure restores the Control menu

'Note that to run this procedure, the Declare statements above

'must be in the module

Sub RestoreSystemMenu()

   'get the window handle of the Excel application

   hWnd = GetActiveWindow()

   'restore system menu to original state

   hMenu% = GetSystemMenu(hWnd, 1)

End Sub

MICROSOFT EXCEL VERSION 5.X

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

'The following procedure disables the Control menu

Declare Function GetActiveWindow Lib "User" () As Integer

'Enter the following Declare statement as a single line

Declare Function GetSystemMenu Lib "User" (ByVal hWnd As Integer, ByVal

bRevert As Integer) As Integer

'Enter the following Declare statement as a single line

Declare Function DeleteMenu Lib "User" (ByVal hMenu As Integer, ByVal

nPosition As Integer, ByVal wFlags As Integer) As Integer

Sub Disable_Control()

   Dim X as Integer

   For X = 1 to 9

      'Delete the first menu command and loop until

      'all commands are deleted

      Call DeleteMenu(GetSystemMenu(GetActiveWindow, False),0,1024)

   Next X

End Sub

'The following procedure restores the Control menu

'Note that to run this procedure, the Declare statements above

'must be in the module

Sub RestoreSystemMenu()

   'get the window handle of the Excel application

   hWnd = GetActiveWindow()

   'restore system menu to original state

   hMenu% = GetSystemMenu(hWnd, 1)

End Sub

NOTES:

The commands on the control menu are numbered starting a zero. The default

control menu items are as follows: Control Menu Restore is item 0, Move is

item 1, Size is item 2, and so on. Even if items are deleted, the first

item always starts at zero.

To delete individual items from the control menu without deleting the

entire menu, you can specify the menu command to delete. For example the

following two lines of code when used in place of the For Next loop in the

procedure Disable_Control above, will delete the Maximize (item 4) and

Minimize (item 3) commands and disable the Maximize and Minimize buttons.

   Call DeleteMenu(GetSystemMenu(GetActiveWindow, False),4,1024)

   Call DeleteMenu(GetSystemMenu(GetActiveWindow, False),3,1024)

KBCategory: kbprg kbcode

KBSubcategory: xlwin

Additional reference words: 5.00 5.00c 7.00 call register remove


XL: Only First 100 Names Listed in the Name Box

Article ID: Q107704

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, only the first 100 defined names are listed in

the name box.

This 100-name limit is by design so that you can quickly define names on a

worksheet from the name box. The greater the number of names listed in the

name box, the longer it takes to define or display a name using the name

box.

NOTE: The names in the name box are listed in alphabetical order.

MORE INFORMATION

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

You can use any defined name by typing it directly into a formula, or by

selecting it from the Paste Name list available by choosing Name from the

Insert menu and choosing Paste. But, you can only select from the first 100

defined names with the Names box.

The total number of defined names you can have in a workbook is limited by

available memory. For more information about the maximum numbers of

elements you can use in a worksheet or workbook, click the Index tab in

Microsoft Excel Help, type the following text

   specifications

and then double-click the selected text to go to the "Microsoft Excel for

Windows 95 specifications" topic.

For more information about the name box, see pages 143-144 in the

"User's Guide," version 5.0.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Scatter Chart Line Disappears After Changing Series Axis

Article ID: Q107753

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you edit a scatter chart that has been formatted

with the ChartWizard or an applied autoformat and if a series in the chart

is formatted with a line pattern, when you change the axis that the series

is plotted on, the line for that series may disappear.

WORKAROUND

==========

When you format a scatter chart with the ChartWizard or with an autoformat,

to change the axis that the series is plotted on while still retaining your

series format, do the following:

1. From the Format Data Series dialog box, choose the Patterns tab. Under

   Line, reselect Automatic (even though it is already selected).

2. Select the Axis tab, and under Plot Series On, select the axis that is

   not already selected.

3. Choose OK to close the Format Data Series dialog box.

NOTE: Steps 1 and 2 above can be done in any order, but must be done

before step 3.

MORE INFORMATION

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

You can plot series on a scatter chart on either the primary axis or the

secondary axis. You can format the series with a combination of line and

marker options. If you use the ChartWizard or an applied autoformat to

format your chart, and if your series is formatted with a line, the line

will disappear in the chart sample if you change the series so that it is

plotted on the secondary axis rather than on the primary axis.

Steps to Reproduce Behavior

---------------------------

1. In a new worksheet, enter the following data:

      A1: 10   B1: 20   C1: 30

      A2: 11   B2: 21   C2: 31

      A3: 12   B3: 22   C3: 32

2. Select the range A1:C3, and press F11 to run the ChartWizard.

3. In the Step 1 Of 5 screen, verify that the Range box contains the

   formula =$A$1:$C$3 and choose Next.

4. In the Step 2 Of 5 screen, under Select A Chart Type, choose XY

   (Scatter) and choose Next.

5. In the Step 3 Of 5 screen, under Select A Format For The XY (Scatter)

   Chart, choose format 2, and choose Next.

6. In the Step 4 Of 5 screen, choose Finish.

7. On the chart, select series 1, and from the Format menu, choose Selected

   Data Series. Select the Axis tab and under Plot Series On select the

   Secondary Axis option.

Series 1 is no longer displayed with a line in the sample chart. The

pattern format has changed just by changing the axis to plot the series on.

REFERENCES

==========

For more information about Applying Colors, Patterns, And Borders To

Chart Items, choose the Search button in Help and type:

   patterns

KBCategory: kbusage kbtlc

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Using Worksheet Functions in Visual Basic Procedures

Article ID: Q107879

----------------------------------------------------------------------

The information in this article applies to :

 - Microsoft Excel for Windows version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

----------------------------------------------------------------------

SUMMARY

=======

Microsoft Excel versions listed above offer two programming languages:

Visual Basic and the Microsoft Excel version 4.0 macro language. Having two

different programming languages can be confusing, especially when both

languages have nearly identical functionality. Microsoft included both

languages to ease the transition to Visual Basic. Both languages give you

complete control of Microsoft Excel. However, you should start working with

Visual Basic, because it is more flexible and powerful and will be the only

programming language in future versions of Microsoft Excel.

In Microsoft Excel versions 5.0 and later, you can combine Visual Basic and

Microsoft Excel version 4.0-style macros: you can run your existing version

4.0 macros from Visual Basic procedures or, in cases where the same

function is available in Visual Basic AND in the Microsoft Excel 4.0 macro

language, you can specify whether you want to use the Visual Basic or

Microsoft Excel 4.0 version of that function.

MORE INFORMATION

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

Visual Basic and Microsoft Excel version 5.0 worksheet functions offer

common functions such as the ABS() function. To make upgrading easier,

Microsoft Excel lets you specify which version of a worksheet function you

want to use in your Visual Basic procedure, either Visual Basic or

Microsoft Excel.

In most cases, there is no difference between the two versions of the same

function.

Example

-------

To include the Visual Basic version of a worksheet function in your

procedure, use the following syntax:

   x = Abs(-1)

If you want to use the Microsoft Excel version of a worksheet function in

your procedure, you need to precede the function name with the Application

object name:

   x = Application.Abs(-1)

To run a Microsoft Excel version 4.0-style macro from your Visual Basic

procedure, use the Run method of the Application object. The Run method

takes as its arguments the name and arguments of the macro you want to run:

   Application.Run(Macro_name, Arg1, Arg2, ...)

Two functions that are not the same in Visual Basic and the Microsoft Excel

4.0 macro language the LOG() function and the IF() function. Because IF is

a reserved keyword in the Visual Basic language, you cannot use the

Microsoft Excel IF() function in your procedures. You are not losing any

functionality, though, because the Visual Basic keyword IF performs the

same logical test as the Microsoft Excel IF() function. The Microsoft Excel

LOG function returns the logarithm of a number to the base that you

specify. The Visual Basic Log function returns the natural logarithm of a

specified number.

For more information about using worksheet functions and the Microsoft

Excel 4.0 macro language in 5.0, see pages 297-299 of the "Visual Basic

User's Guide."

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Macro to Print a Group of Files Located in Same Directory

Article ID: Q107880

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Macintosh, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

In Microsoft Excel, you can use the following Visual Basic macro to print a

batch of files that are all located in the same directory. The macro

requests a directory name and then prints all the files in that directory.

Sample Macro Code

-----------------

Sub Batch_Print()

Dim Input_Dir, Print_File As String

   Input_Dir = InputBox("Input directory path containing the files

      to print")

    ' Defines Print_File equal to the first Microsoft Excel file found in

    ' the directory specified in the InputBox above.

    Print_File = Dir(Input_Dir & "\*.xl*")

   'If you are using Microsoft Excel for the Macintosh, you need

   'to change Print_File = Dir(Input_Dir & "'   .xl*") to

   '

   '   Print_File = Dir(Input_Dir & ":" & MacID("XLS5"))

   '

   'and change Workbooks.Open Filename:=Input_Dir & "\" & Print_File to:

   '

   '   Workbooks.Open Filename:=Input_Dir & ":" & Print_File

      ' Loops through the directory specified in the above InputBox

      ' and opens each workbook in the directory, prints all sheets

      ' in the workbook and closes the workbook. Continues until are

      ' all files are printed.

      Do While Len(Print_File) > 0

          Workbooks.Open Filename:=Input_Dir & "\" & Print_File

          ActiveWorkbook.PrintOut Copies:=1

          ActiveWorkbook.Close

          Print_File = Dir()

      Loop

End Sub

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

REFERENCES

==========

"Visual Basic Reference," version 5.0, pages 143-145

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 5.00


XL: ChDir May Fail When Changing to a Root Directory

Article ID: Q108351

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Macintosh, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the Visual Basic ChDir statement will fail if the path

argument does not contain a backslash character (\). This requirement may

cause problems if you use ChDir to change to a root directory, because the

path of a root directory does not necessarily contain a backslash.

NOTE: When you use Microsoft Excel version 7.0, you won't get an error

message, but the directory won't change.

For example, the following Visual Basic code will fail

   ChDir "C:"

and you will receive the following error message:

   Run-time error '76':

   Path not found

The following lines of code will succeed, because they each contain a

backslash:

   ChDir "C:\"  <or>  ChDir "C:\EXCEL\LIBRARY"

It is possible to incorporate error-handling into a ChDir function to

prevent an error from occurring. The Visual Basic code example below

demonstrates one way to do this.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

This Visual Basic code example displays an input box which asks you

which drive or directory you would like to switch to. When you

enter a drive or directory, the example checks whether the path you

enter contains a backslash and adds one, if needed, before switching

to that drive or directory.

To run the example, position the insertion point in the line that reads

"Sub MainMacro()" and choose Start from the Run menu.

'----------------------------------------------------------------------

Option Explicit

Sub MainMacro()

   'Dimension some variables.

   Dim NewDir As Variant

   'Prompts you to enter a drive/directory. For example, D: or C:\EXCEL.

   'If you type in an invalid directory, the subroutine will fail. For

   'example, typing just "C" (without the quotes) is not going to work.

   NewDir = InputBox("Switch to which drive/directory?")

   'If the NewDir ends in a colon, indicating it is a root directory,

   'concatenate a backslash onto the end of it. For example, C: would

   'become C:\. If you actually enter "C:\", the subroutine doesn't add

   'another backslash.

   If Right(NewDir, 1) = ":" Then

      NewDir = NewDir & "\"

   End If

   'Switches to the proper drive (the first letter in NewDir: 'Left'

   'gives us this) and directory.

   ChDrive Left(NewDir, 1)             'change to the drive (C:, etc.)

   ChDir NewDir                        'change to the directory

   'Display the name of the current directory so you know it worked.

   MsgBox "Current directory is " & CurDir()

End Sub

'----------------------------------------------------------------------

The If-End If routine is the error-checking procedure. Whenever you use a

ChDir statement, preceding it with the If-End If routine (or some variation

of it) can help prevent the "no backslash" error.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 5.0


XL5: Can't Run Macros That Use File Functions Add-in Functions

Article ID: Q108356

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

---------------------------------------------------------------------

SUMMARY

=======

Although Microsoft Excel version 5.0 does not include the File Functions

(FILEFNS.XLA) add-in macro (or the associated FILEFNS.DLL file), if you

install Microsoft Excel version 5.0 without deleting the earlier version of

Microsoft Excel (3.0 or 4.0), the FILEFNS.XLA add-in macro will still be

available and will function normally (because the file is not deleted when

you install version 5.0). However, if you do a "clean" installation of

Microsoft Excel 5.0 (that is, if you delete the earlier version of

Microsoft Excel before you install version 5.0), and you then run a macro

that uses any of the FILEFNS.XLA add-in functions, you will receive a macro

error.

Most of the file maintenance tasks that you can do with the File Functions

add-in functions can be done with Visual Basic procedures.

MORE INFORMATION

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

The following table lists the functions that are available in the File

Functions add-in macro and their Visual Basic equivalents.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

File Functions

Macro Command       Equivalent Visual Basic Statement

------------------------------------------------------------------------

=CREATE.DIRECTORY() MkDir "MYDIR"

=DELETE.DIRECTORY() RmDir "MYDIR"

=DIRECTORIES()      MyDir = Dir(pathname,16)

                    'call repeatedly until Dir return a zero-

                    'length string

=OPEN.DIALOG()      MyDialog = Application.GetOpenFilename(fileFilter, _

                    FilterIndex,Title,buttonText)

                    ' This second form will bring up Microsoft

                    ' Excel's internal Open Dialog Box

                    MyDialog2=Application.Dialogs(xlDialogOpen).Show

                    ' will bring up default open dialog

=SAVE.DIALOG()      MyDialog=Application.GetSaveAsFilename _

                    (initialFilename,fileFilter,filterIndex,title, _

                     buttonTitle)

                    ' This second form will bring up Microsoft

                    ' Excel's 'internal SaveAs Dialog Box

                    MyDialog2=Application.Dialogs(xlDialogSaveAs).Show

                    ' will bring up default Save As dialog

=FILE.EXISTS()      MyFile = Dir(pathname)

REFERENCES

==========

For more information about GetOpenFilename, choose the Search button in

Help and type:

   getop

For more information about GetSaveasFilename, choose the Search button

in Help and type:

   gets

For more information about "Visual Basic Equivalents for Macro Functions

and Commands," choose the Search button in Help and type:

   Visual Basic equivalents, macro functions

KBCategory: kbprb

KBSubcategory:

Additional reference words: 5.00 5.00c 5.00a


XL: Errors if XL5GALRY.XLS Saved wth Password

Article ID: Q108358

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel version , if you open the XL5GALRY.XLS file, located

in your EXCEL\XLSTART directory, and then save it with a password, you may

be prompted to enter a password whenever you attempt to perform certain

actions.

It is recommended that you DO NOT save the XL5GALRY.XLS file with any

kind of password.

MORE INFORMATION

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

Microsoft Excel saves user-defined autoformats and other chart information

in the XL5GALRY.XLS file, located in the EXCEL\XLSTART directory. This file

is modified through choices that you make in various dialog boxes in

Microsoft Excel.

If you open XL5GALRY.XLS and then save it with a password, you may notice

the following unexpected behavior when you are working in Microsoft Excel,

version 5.0 and later:

 - If you choose Options from the Tools menu, you may be prompted to

   enter a password. If you enter the correct password, the Options

   dialog box will appear and you should have full access to all

   options. If you do not enter a password, you will receive the error

   message

      Error accessing User-defined AutoFormat file

   and the Options dialog box will appear. However, you will not be

   able to change the Default Chart Format setting on the Chart tab.

 - If you choose AutoFormat from the Format menu when a chart is

   active, selecting the User-Defined option may result in a

   prompt for a password. If you enter the correct password, you

   should be able to make any desired changes to the User-Defined

   options.

   If you do not enter a password, you may receive the error message

      Error accessing User-defined AutoFormat file

   and you may not be able to access or define custom formats,

   depending on the type of password which has been set.

For the above reasons, and because there may be other negative

effects associated with a password-protected XL5GALRY.XLS file, it is

recommended that you DO NOT save the XL5GALRY.XLS file with any kind

of password.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Inconsistent Results Moving Chart Data Labels

Article ID: Q108369

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, if you move data labels in a column chart from the top

of a column to near the bottom of the column, and the value for that column

changes to a lower or negative value, the data label will either not be

visible or will change position.

MORE INFORMATION

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

Calculation of the position of data labels in a column chart is based on

the distance from the top of the column: if a column becomes shorter due to

a lower value, the data label will shift down accordingly. This shift can

force the data label to be positioned outside of the plot area, where it is

not visible. If the column value becomes negative, the data label will

position itself at the same distance from the top of the column (now

inverted) on the positive side of the x axis.

Steps to Reproduce Behavior

---------------------------

1. In a worksheet, enter the following data:

     A1:  1

     A2:  2

     A3:  3

     A4:  4

2. Select the range A1:A4, choose Chart from the Insert menu, and then

   choose As New Sheet.

This will bring up ChartWizard Step 1 of 5.

3. Choose Finish to create a standard column chart.

4. Click once on any one of the columns to select the entire series.

5. From the Format menu, choose Selected Data Series.

6. Select the Data Labels tab, choose Show Value, and choose OK to accept

   the change.

This will put data labels at the top of each column in the chart.

7. Select the data label above the third column, and drag it to the bottom,

   placing it on the column between y value 0 and 0.5 (in the lower 6th

   area of the column).

8. On the spreadsheet, change the value of 3 in cell A3 to 2.

The data label for the third column will no longer be visible.

9. On the spreadsheet, change the value of 2 in cell A3 to -2.

The data label for the third column will be displayed, but it will be

positioned above the column at approximately y value of 2.

REFERENCES

==========

"User's Guide," version 5.0, pages 277-278

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: Window Options Not Saved in Workspace File

Article ID: Q108474

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you open a workspace file, all the workbooks in

the workspace file have the following Window Options settings on the View

tab of the Options dialog box.

   Window Options          Setting

   -------------------------------

   Automatic Page Breaks   Clear

   Formulas                Clear

   Gridlines               Selected

   Color                   Automatic

   Row & Column Headers    Selected

   Outline Symbols         Selected

   Zero Values             Selected

MORE INFORMATION

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

The Window Options are saved in each individual workbook. If you save a

workbook with the Gridlines option cleared, when you open the workbook,

gridlines are not displayed.

Workspace files save the workbooks you have open, including their size,

arrangement, and position on the screen. When you open a workspace file,

all of your workbooks appear with the same settings they had when you

closed them. However, when you save a workspace file, the Automatic Page

Breaks, Formulas, Gridlines, Color, Row & Column Headers, Outline Symbols,

or Zero Values options are not saved. When you open a workspace file, all

the workbooks are displayed with the default settings listed above.

Additionally, split, frozen, or zoomed panes on a worksheet are not always

saved in a workspace file. For more information about split, frozen, or

zoomed panes, please see the following article(s) in the Microsoft

Knowledge Base:

   ARTICLE-ID: Q113803

   TITLE     : XL: Split or Frozen Panes Not Saved in Workspace

   ARTICLE-ID: Q10042

   TITLE     : Zoom Setting Lost When Workspace File Saved and Reopened

REFERENCES

==========

For more information about Creating And Saving A Workspace File,

choose the Search button in Help and type:

   workspace files

KBCategory: kbui kbusage

KBSubcategory:

Additional reference words: 5.00 5.00a 5.00c 7.00


XL: Cannot Open Workbook When Dependent Worksheet Is Open

Article ID: Q108475

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SYMPTOMS

========

When you open a workbook or worksheet in Microsoft Excel version 4.0, if

the worksheet has been saved from Microsoft Excel version 5.0, you may

receive one of the following error messages and you will be unable to open

the workbook:

   Microsoft Excel for Windows

   ---------------------------

   A document with that name is a supporting document. Workbooks can't be

   supporting documents.

   Microsoft Excel for the Macintosh

   ---------------------------------

   Workbooks cannot be supporting documents.

CAUSE

=====

This problem occurs if a formula in the current worksheet (dependent

document) contains a formula with a link to a workbook (source document)

that has been saved from Microsoft Excel version 5.0, and the link is to a

worksheet with the same name as the workbook it is contained in. In

Microsoft Excel version 5.0, when you save a workbook as a Microsoft Excel

version 4.0 workbook or worksheet that contains a link to another

worksheet, the link may be saved with only the workbook in the reference if

the source worksheet has the same name as the workbook it is contained in.

For example, the reference

   =[SALES.XLW]Sales!$A$1 (in Windows)

appears as

   ='C:\EXCEL\SALES.XLW'!$A$1

(where C:\EXCEL is the full path to the source document) when it is saved

as a Microsoft Excel 4.0 worksheet or workbook and opened in Microsoft

Excel version 4.0.

In Microsoft Excel 4.0, when the worksheet with this link is open, you will

be unable to open the workbook that the link is referring to.

WORKAROUND

==========

In order to open both a source workbook and a dependent worksheet that have

been saved in the Microsoft Excel version 4.0 format, do either of the

following:

 - If Microsoft Excel version 5.0 is available, open the workbook that

   contains the worksheet with the same name, and rename the worksheet.

   -or-

 - If Microsoft Excel version 5.0 is not available, change the link on the

   dependent file by doing the following:

   1. In Microsoft Excel version 4.0, open the dependent worksheet. Choose

      No to update references to unopened documents.

   2. From the File menu, choose Links.

   3. From the Links list, choose the link to the source workbook and

      choose Change. From the File Name list, choose the source workbook

      and choose OK.

   4. From the Select The Bound Document list, choose the source worksheet.

      In the Links dialog box, choose Close.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 5.00a 5.00c


XL: Error When Macro Closes Its Own Workbook

Article ID: Q108507

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if a Visual Basic procedure is started by an

OnSheetDeactivate command and the procedure then closes the workbook in

which it is contained, one of the following occurs:

 - In Microsoft Excel for Windows, you receive a general protection (GP)

   fault.

 - In Microsoft Excel for the Macintosh, you receive the following error

   message:

      The application "Microsoft Excel" has unexpectedly quit, because an

      error of type 1 occurred.

CAUSE

=====

This error occurs only if a sheet is deleted by choosing Delete Sheet from

the Edit menu or from the Sheet Tabs menu; it does not occur if a sheet is

deactivated by switching to another sheet.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post more information here in the Microsoft Knowledge Base as it

becomes available.

KBCategory: kbprg kbbuglist

KBSubcategory:

Additional reference words: 7.00 5.00 crash hang freeze lock-up


XL: Range.EntireRow May Return Incorrect Result

Article ID: Q108518

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the Range.EntireRow method may return an incorrect

result if the Range is a nonadjacent selection. For example, if the current

Range is the nonadjacent selection $A$1:$A$3, $C$11:$C$13, the

Range.EntireRow method will return $1:$13, not $1:$3,$11:$13 as would be

expected.

This also occurs when you use the Range.EntireColumn method to return

entire columns when the Range is nonadjacent.

MORE INFORMATION

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

You can create a nonadjacent selection by selecting a range and then

selecting another range while holding down the CTRL key on your keyboard or

by using Microsoft Excel version 4.0 or Visual Basic commands that select

two or more ranges at the same time.

To return the correct rows or columns in a selection when the selection is

nonadjacent, you must separate the selection into Areas, where an Area is

defined as a single piece of a nonadjacent selection. This process is

illustrated in the Visual Basic code example below.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

NOTE: To convert this example to work with columns, use "Column" in place

of "Row."

To use the SelectRows subroutine, select any combination of cells on

sheet1. (This example assumes the current selection is

$A$1:$A$3,$C$11:$C$13 on Sheet1.) Then, choose Macro from the Tools

menu, select the name SelectRows from the list of macro names, and

choose Run.

'----------------------------------------------------------------------

Option Explicit

Sub SelectRows()

   'Dimension some variables.

   Dim Counter As Integer, X As Variant, Y As Variant

   Sheets("Sheet1").Activate            'ensure the worksheet is active

   'Sets range X equal to the current selection.

   Set X = Selection

   'Initializes range Y equal to the first Area in X.

   Set Y = X.Areas(1)

   'Iterate through the loop once for each Area (nonadjacent piece)

   'of the range X.

   For Counter = 1 To X.Areas.Count

      'Set Y equal to the union of its previous range and the range of

      'the rows which encompass the current Area.

      Set Y = Application.Union(Y, X.Areas(Counter).EntireRow)

   Next                                 'loop until all done

   Y.Select                             'select the range Y

End Sub

'----------------------------------------------------------------------

For example, if you select the range $A$1:$A$3,$C$11:$C$13 on worksheet

Sheet1 and then run the SelectRows subroutine, the subroutine determines

how many Areas there are in the selection (there are two: $A$1:$A$3 and

$C$11:$C$13), determines which combination of rows encompasses each Area

($1:$3, $11:$13), and selects the range $1:$3,$11:$13.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 5.0 Selection.EntireRow 7.00

Selection.EntireColumn


XL: Running Subroutines and Macros from Visual Basic

Article ID: Q108519

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel versions 5.0 and later, you can run Visual Basic

subroutines and Microsoft Excel version 4.0 macros from a Visual Basic

subroutine by using the Application.Run and Application.ExecuteExcel4Macro

methods. You can also run Visual Basic subroutines with the Call method or

by entering the name of a subroutine on a line by itself.

This article illustrates several methods that you can use to run

subroutines and Microsoft Excel version 4.0 macros from Visual Basic in

Microsoft Excel.

MORE INFORMATION

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

To Use the Application.Run Method

---------------------------------

You can use the Application.Run method to run Visual Basic subroutines or

Microsoft Excel version 4.0 macros from other Visual Basic subroutines. The

Application.Run method requires one named argument: the name of the macro

or subroutine to be run. (However, other optional arguments may also be

included.) This name can be a text string (for example, "TestXLM") or it

can be a variable that is equal to the name of the macro.

For example, to run an Microsoft Excel version 4.0 macro called TestXLM,

you could use this method:

   Application.Run ("TestXLM")

If you have the variable "MacroToRun", whose value is equal to

"TestXLM", you could use this method:

   Application.Run (MacroToRun)

To Use the Application.ExecuteExcel4Macro Method

------------------------------------------------

You can also use the Application.ExecuteExcel4Macro method to run Microsoft

Excel version 4.0 macros or other Visual Basic subroutines, but the syntax

is somewhat different. To use Application.ExecuteExcel4Macro to run a macro

or subroutine, you must also include the Microsoft Excel version 4.0 RUN()

function, as in the following examples:

   Application.ExecuteExcel4Macro "RUN(""TestXLM"")"

   -or-

   Application.ExecuteExcel4Macro "RUN(""" & MacroToRun & """)"

Note that when you use Application.ExecuteExcel4Macro you must use

quotation marks. For example, to use the RUN() function, you must enclose

the name of the argument in quotation marks:

   RUN("TestXLM")

Because the entire string must also be enclosed in quotation marks, when

you add quotation marks to the outside of the string, you must also add an

additional quotation mark adjacent to each quotation mark within the

string. The resulting string is as follows:

   "RUN(""TestXLM"")"

The Application.ExecuteExcel4Macro command that uses a variable inside

the RUN() function is more complex than the equivalent Application.Run

method. For the command to be properly evaluated, the macro string

must be entered as:

   "RUN(""" & MacroToRun & """)"

This command is evaluated as

   RUN("" & MacroToRun & "")

which is a valid Microsoft Excel version 4.0 macro command.

To Use the Call Method

----------------------

The Call method may be used to run Visual Basic subroutines, but not

Microsoft Excel version 4.0 macros. For example, to run the subroutine

TestVBSub, you would use this method:

   Call TestVBSub

Note that you cannot pass a variable name to the Call method. For example,

if you have the variable "SubToRun", whose value is equal to "TestVBSub",

you cannot run the TestVBSub subroutine with the following:

   Call SubToRun

To Run a Subroutine Using Only Its Name

---------------------------------------

You can also run a Visual Basic subroutine by entering its name on a line

by itself. For example, if you want your subroutine to run the TestVBSub

subroutine, you would enter

   TestVBSub

on a line by itself. When that line in the subroutine is executed, it will

run the TestVBSub subroutine.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

To create six subroutines that illustrate the most common methods you can

use to run a Visual Basic subroutine or Microsoft Excel version 4.0 macro

from another Visual Basic subroutine, do the following:

1. In a new workbook, insert a Microsoft Excel 4.0 macro sheet called

   Macro1 and a Visual Basic module called Module1.

2. On the macro sheet, enter the following macro:

   A1: TestXLM

   A2: =ALERT("TestXLM works!")

   A3: =RETURN()

   This macro displays an alert box.

3. On the macro sheet, select cell A1.

4. From the Insert menu, choose Name, and then choose Define.

5. Verify that the following information appears in the Define Name dialog

   box:

    - The Names In Workbook box contains the name TestXLM.

    - The Refers To box contains the reference =Macro1!$A$1.

    - The Command option is selected under Macro.

   When the settings are as specified above, choose OK to define the name

   of the macro.

6. In Module1, enter the following subroutines:

'----------------------------------------------------------------------

Option Explicit

'The TestVBSub subroutine displays a message box: it is the Visual

'Basic equivalent of the TestXLM macro shown above.

Sub TestVBSub()

   MsgBox "TestVBSub works!"             'displays a message box

End Sub

'The Test1 subroutine makes use of the Application.Run method with

'hard-coded macro/subroutine names.

Sub Test1()

   Application.Run ("TestVBSub")

   Application.Run ("TestXLM")

End Sub

'The Test2 subroutine makes use of the Application.Run method with

'variable macro/subroutine names.

Sub Test2()

   Dim SubToRun As String, MacroToRun As String

   SubToRun = "TestVBSub"

   MacroToRun = "TestXLM"

   Application.Run (SubToRun)

   Application.Run (MacroToRun)

End Sub

'The Test3 subroutine makes use of the Application.ExecuteExcel4Macro

'method with hard-coded macro/subroutine names.

Sub Test3()

   'Note the extra quotation marks which are contained within the RUN

   'statements. These are required in order for the command to evaluate

   'properly.

   Application.ExecuteExcel4Macro "RUN(""TestVBSub"")"

   Application.ExecuteExcel4Macro "RUN(""TestXLM"")"

End Sub

'The Test4 subroutine makes use of the Application.ExecuteExcel4Macro

'method with variable macro/subroutine names.

Sub Test4()

   Dim SubToRun As String, MacroToRun As String

   SubToRun = "TestVBSub"

   MacroToRun = "TestXLM"

   'Note the extra quotation marks which are contained within the RUN

   'statements. These are required in order for the command to evaluate

   'properly.

   Application.ExecuteExcel4Macro "RUN(""" & SubToRun & """)"

   Application.ExecuteExcel4Macro "RUN(""" & MacroToRun & """)"

End Sub

'The Test5 subroutine uses the Call method with hard-coded

'subroutine names.

Sub Test5()

    Call TestVBSub

End Sub

'The Test6 subroutine runs the TestVBSub subroutine because its name is

'entered on a line by itself.

Sub Test6()

   TestVBSub

End Sub

'----------------------------------------------------------------------

When you run Test1, Test2, Test3, or Test4, two alert boxes will appear

with the messages "TestVBSub works!" and "TestXLM works!" When you run

Test5 or Test6, one alert box will appear with the message "TestVBSub

works!"

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Range_Lookup Argument in VLOOKUP() Finds Exact Match

Article ID: Q108639

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel versions 5.0 and later, the VLOOKUP() function contains

an argument called range_lookup. The syntax of this function is different

than in earlier versions and is defined as follows

   =VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)

where:

   Argument     Definition of argument

   ---------------------------------------------------------------------

   lookup_value The value to be found in the first column of the array.

   table_array  The table of information in which data is looked up.

   col_index    The column number in the table_array for which the

                matching value should be returned.

   range_lookup This is a new argument used only in Microsoft Excel

                version 5.0. It is a logical value that specifies whether

                you want to find an exact match or an approximate match.

                If TRUE or omitted, an approximate match is returned; in

                other words, if an exact match is not found, the next

                largest value that is less than the lookup_value is

                returned. If FALSE, VLOOKUP() will find an exact match.

                If an exact match is not found, the #N/A error value is

                returned.

NOTE: If range_lookup is TRUE or omitted (that is, an approximate match),

the values in the first column of table_array must be sorted in ascending

order. If range_lookup is FALSE (that is, an exact match), the table_array

does not need to be sorted.

In earlier versions of Microsoft Excel, the INDEX() and MATCH() functions

must be used to find an exact match in the table_array.

For additional information about using the VLOOKUP function in earlier

versions of Microsoft Excel, please see the following article in the

Microsoft Knowledge Base:

   ARTICLE ID: Q77114

   TITLE     : Performing a Lookup with Unsorted Data in Excel

REFERENCES

==========

For more information about VLOOKUP(), choose the Search button in Help and

type:

   compare lookup return

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 5.00a 5.00c


XL: Basis Argument for Financial Functions

Article ID: Q108725

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

This article describes the Basis argument and how it is evaluated in

Microsoft Excel financial functions.

MORE INFORMATION

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

Basis is the type of day count basis as it relates to financial equations.

The following is a list of Microsoft Excel financial functions that use a

basis:

ACCRINT()      COUPNUM()      ODDFPRICE()      PRICEDISC()

ACCRINTM()     COUPPCD()      ODDFYIELD()      PRICEMAT()

COUPDAYS()     DISC()         ODDLPRICE()      RECEIVED()

COUPDAYSNC()   DURATION()     ODDLYIELD()      YIELD()

COUPNCD()      MDURATION()    PRICE()          YIELDDISC()

There are five types of basis in Microsoft Excel 5.0 (version 4.0 contains

four types). The new basis is the European Basis 30/360.

The table below explains all five types of bases with examples for each

type:

Basis           Day count basis

---------------------------------

0 or omitted    30/360

1               Actual/actual

2               Actual/360

3               Actual/365

4               European form 30/360

Basis 4 treats the end of February and the 31st of a month differently than

the NASD (National Security Dealers) or SIA (Securities Industry

Association).

Basis Types:

------------

0 or omitted Basis - 30/360 - This means there is 30 days a month for a

total of 360 days a year. The yields of agencies are calculated on this

basis. These agencies include Government-sponsored organizations that make

up a range of Federal Banks, Loan Mortgage Banks. This method uses 180

days.

1 - The Actual/actual is used by Treasuries (Backed by the U.S. Government,

no risk investment) which means there are the actual number of days

counted. This takes into account if there is a leap year. In reality there

could be 365 or 366 days.

2 - The Actual/360 - This method will use the actual method above but

only has 360 days per year.

3 - The Actual/365 - Same as above, but there will be 365 days per year.

4 - The European Form 30/360 - This is the European method for

starting and ending dates that occur on the 31st of the month. For

example: if the starting or ending date is the 31st of a month, it

then becomes equal to the 30th of the same month.

REFERENCES

==========

For more information about Basis, choose the Search button in Help and

type:

   Financial Functions

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 4.00 4.00a 5.00 Security Securities Time


XL: Cells.Find Returns Error When No Match Found

Article ID: Q108892

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you run a recorded Visual Basic macro, the Cells.Find, Columns.Find,

Selection.Find, and Range.Find functions will produce the following macro

error if no data is found:

   Runtime error '91':

   Object variable not Set

This macro error occurs because the Visual Basic Find method returns

a NULL value which makes activating a cell impossible.

WORKAROUND

==========

The following Visual Basic example will attempt to find the text

string "mystring" and produces an alert message which will not cause

the macro to halt.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

Sub Find_Macro()

    mystring = "mystring"

    Set RangeObj = Cells.Find(What:=mystring, After:=ActiveCell, _

    LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _

    SearchDirection:=xlNext, MatchCase:=False)

    If RangeObj Is Nothing Then MsgBox "Not Found" Else RangeObj.Select

End Sub

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 VB


XL: Macro to Open the Most Recently Used File

Article ID: Q109113

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can access a list of the four most recently used

files by selecting the File menu. The following macro opens the first file

in that list:

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide." Further

description goes under this heading. You should provide details of

how the feature works. If it's by design but not what you would

normally expect to happen, describe what does occur and why (if you

have that information).

The following macro will open the most recently used file. Before you run

this macro you must make sure that the most recently used file list is

turned on. To verify that this option is selected, choose Options from the

Tools menu and then select the General tab. Make sure that the Recently

Used File List box is checked.

Sub Open_File_Macro()

   'sets a variable for "item" to the last most recently

   'open file

   'the following two lines should be entered as one single line

   Item = MenuBars("Worksheet").Menus("file")._

   MenuItems("file list").Caption

   'sets item to "file" and deletes the first 3 letters

   'from the file list

   file = Mid(Item, 4, 24)

   Workbooks.Open filename:=file  'opens the file

End Sub

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL5 AppNote: Upgrade and Setup Questions and Answers (WE0922)

Article ID: Q109190

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

Following is the complete text for the FastTip for Microsoft Excel

version 5.0 for Windows. It contains the commonly asked questions and

answers about upgrade and setup.

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

  Microsoft(R) Product Support Services Application Note (Text File)

            WE0922: UPGRADE AND SETUP QUESTIONS AND ANSWERS

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

                                                  Revision Date: 12/93

                                                      No Disk Included

The following information applies to Microsoft Excel, version 5.0.

----------------------------------------------------------------------

| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |

| ACCOMPANY THIS DOCUMENT (collectively referred to as an Application|

| Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER     |

| EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED     |

| WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR      |

| PURPOSE. The user assumes the entire risk as to the accuracy and   |

| the use of this Application Note. This Application Note may be     |

| copied and distributed subject to the following conditions:  1) All|

| text must be copied without modification and all pages must be     |

| included;  2) If software is included, all files on the disk(s)    |

| must be copied without modification (the MS-DOS(R)  utility        |

| diskcopy is appropriate for this purpose);  3) All components of   |

| this Application Note must be distributed together;  and  4) This  |

| Application Note may not be distributed for profit.                |

|                                                                    |

| Copyright (C) 1993 Microsoft Corporation.  All Rights Reserved.    |

| Microsoft, Microsoft Access, MS-DOS, Multiplan, PowerPoint, and    |

| Visual Basic are registered trademarks and                         |

| AutoSum, IntelliSense, PivotTable, TipWizard, Windows, and Windows |

| NT are trademarks of Microsoft Corporation.                        |

| Quattro is a registered trademark of Borland International, Inc.   |

| 1-2-3 and Lotus are registered trademarks and Allways is a         |

| trademark of Lotus Development Corporation.                        |

----------------------------------------------------------------------

1.  Q. What are the new features in Microsoft Excel version 5.0

       for Windows?

    A. Microsoft Excel version 5.0 sets a new standard for

       spreadsheets. Built-in intelligence and innovative features let

       you focus on your analysis, not your data. And rich, custom-

       development tools help you build the solutions you want. It all

       adds up to an intelligent spreadsheet that works the way it

       should--the way you want.

       Microsoft Excel is the spreadsheet that works the way you want

       to, so your work is easier. That's because as a member of the

       Microsoft Office family of programs, Microsoft Excel features

       IntelliSense(TM) technology: built-in intelligence that senses

       what you want to do and helps you do it--so routine tasks are

       automatic and complex jobs are easier. IntelliSense redefines

       ease of use with automatic features and wizards that step you

       through tasks. And if there's a more effective way of working,

       Microsoft Excel even suggests tips through the revolutionary

       new TipWizard(TM)  assistant to save you time and expand your

       knowledge of Microsoft Excel.

       You'll also find that you'll have complete control over

       everything in your spreadsheet. Now you can directly enter and

       edit information in cells and manipulate data and charts,

       giving you a faster and easier way to do your work. Microsoft

       Excel introduces a new way to work with data that lets you

       instantly create dynamic views and reports of your data, so you

       can spend time analyzing, rather than accessing and setting up

       information. And you can develop your own solutions with easy-

       to-use tools to customize your spreadsheet and rich development

       tools to build powerful enterprise solutions.

       Microsoft Excel also features OfficeLinks, which let you work

       with other programs, as well as with others in your workgroup,

       so you can include the most recent information in your

       analysis. And best of all, Microsoft Excel is part of the

       family of Microsoft Office programs that work alike and work

       together, so when you learn one, you're on your way to learning

       them all. With Microsoft Excel, you can focus on your work,

       rather than your computer. Maybe that's why it's the most

       popular spreadsheet for Windows.

       Gain Visual and Direct Control

       ------------------------------

        - Enter and edit information by typing it directly into cells.

          Click a cell to change the font size, the character

          formatting, the color, size, or orientation, of any part of

          the entry.

        - Select and build formulas with the Function Wizard--it helps

          you build formulas, assists you with arguments, and lists

          your most recently used functions.

        - Click the right mouse button to see context-sensitive

          shortcut menus.

        - Manipulate individual or groups of cells more easily by

          clicking the right mouse button or by dragging data. It's a

          fast way to cut, copy, and paste data.

        - Tab dialog boxes combine your options into one intuitive box,

          so you don't have to go searching through different menus.

        - Every file is a workbook that contains as many related sheets

          as you like. Workbook tabs make it easier to navigate through

          and select these sheets.

        - Workbooks let you simultaneously edit or format multiple sheets.

        - Quickly understand linked worksheets and errors with the new

          auditing tools. With one click, Microsoft Excel traces formulas

          to give you a visual representation of the formulas in a

          worksheet, and traces formula errors to their origin.

        - Identify buttons and toolbars quickly with ToolTips. Modify

          button images right in Microsoft Excel with the new Button

          Editor. If you're using a high-resolution graphics adapter, you

          can switch to the new Large Buttons option.

       IntelliSense Technology Lets You Do More with Less Effort

       ---------------------------------------------------------

        - Take advantage of a built-in, personal coach. TipWizard watches

          you as you work and gives you tips on how to work faster and

          smarter.

        - Leave the adding to Microsoft Excel. The AutoSum(TM) feature

          intelligently sums ranges and can sum rows and columns

          simultaneously.

        - Save time and effort typing in commonly entered data. The

          AutoFill feature recognizes trends in numbers and dates, and

          intelligently extends the selected series. Use the custom

          AutoFill feature to add your own series.

        - Make every worksheet look professional instantly with the

          AutoFormat feature. Take advantage of a number of existing

          formats, such as the accounting autoformats.

        - View a subset of your information with the AutoFilter command.

          Microsoft Excel provides you with a list of choices so that you

          can select the type of data you want to see.

        - Sort data easily and flexibly with the Sort buttons or define

          custom sort orders.

        - Choose the Subtotals command to automatically generate subtotals

          for your data.

        - Use the Auto Outline command to create reports at any level of

          detail with a few mouse clicks.

       Plot Your Data So That It Appears the Way You Want It to Appear

       ---------------------------------------------------------------

        - Create meaningful charts from your data with the ChartWizard

          (which walks you through the chart-creation process and

          makes it easy for you to choose your own options).

        - Manipulate chart formats to get the exact chart layout you

          want: you can directly select, resize, and format parts of

          your chart, such as the legend, title, and plot area.

        - Update your chart instantly by dragging new data to the

          chart. The new information is automatically plotted for you.

        - Save preferred chart formats with a custom autoformat. Then

          reapply the entire format with a mouse click.

        - Mix chart types into one chart with combination charts. You

          can apply a different chart type for each series. For

          example, you can plot the values for "Revenue" on a line and

          values for "Expenses" in a column on the same chart.

        - Use the Trendline command to create a best-fit line and

          perform automatic forecasting.

       Discover a New Way to Analyze Data

       ----------------------------------

       The PivotTable(TM) Wizard steps you through building a summary

       table of your data that you can use to:

        - View and analyze data.

        - Build different reports and views by dragging and dropping

          headings any way you like.

        - Take the monotony out of your analysis with automatic

          calculations such as comparisons, averages, and percentages

          of totals.

        - Use the Grouping features to combine data.

       Easily Share Files and Work with Others

       ---------------------------------------

       Effectively work with others with the Workgroup toolbar:

        - The Find File button makes it easy to search for files by

          name, author, or date.

        - Interactive file sharing lets you share files, notifies you

          when files are available, and updates read-only files with

          the most recent changes.

        - The Send Mail button allows you to send mail right from

          Microsoft Excel and include files as attachments.

        - Use the Routing Slip button to send documents individually

          or to an entire team.

        - You can route documents individually in the order you

          specify, or all at once. You are notified as revisions are

          completed and are updated about a document's routing

          progress.

        - Take advantage of an improved Scenario Manager. Now you can

          create what-if scenarios on multiple ranges of cells and

          view and access those scenarios from a list on the Workgroup

          toolbar. You can even merge scenarios from others in your

          workgroup.

        - Make a summary report of your scenario by creating a

          PivotTable of your scenarios. Analyze the impact of

          different scenarios by pivoting your summary report.

       Access and Retrieve Data Easily

       -------------------------------

        - Save time by using the TextWizard to import files exactly

          the way you want.

        - Import data to Microsoft Excel with Microsoft Query.

          Microsoft Query supports open database connectivity (ODBC),

          which provides connections to a wide range of external data.

       Customize Your Worksheet

       ------------------------

        - Place controls directly on your worksheet to automate your

          work without macros.

        - Customize your toolbars easily.

        - Use the macro recorder to automate your tasks with the new

          Visual Basic(R) Programming System, Applications Edition,

          language or with the Microsoft Excel 4.0 macro language.

       Make Your Spreadsheet Part of a Complete Solution

       -------------------------------------------------

        - Create more-powerful programs easily with the common macro

          language Microsoft Visual Basic Programming System,

          Applications Edition. This one language allows you to build

          custom solutions for multiple programs.

        - Support for object linking and embedding (OLE) 2.0 lets

          Microsoft Excel work with other programs toward your

          solutions.

       Learn Microsoft Excel Using Your Lotus(R) 1-2-3(R) Experience

       -------------------------------------------------------------

        - You can use familiar 1-2-3 commands and the Lotus 1-2-3

          transition options to demonstrate equivalent Microsoft Excel

          commands.

        - Transfer files without losing file compatibility with Lotus

          WKS, WK1, WK3, Impress, Allways(TM), Multiplan(R), and

          Quattro(R) Pro for the MS-DOS operating system.

        - Transfer existing files more easily with improved 3-D

          capabilities.

        - Use the Macro Interpreter for Lotus 1-2-3 to run all release

          2.01 and most release 2.2 and 2.3 macros unmodified.

       The Microsoft Office Family: A Whole New Way to Work

       ----------------------------------------------------

       Go further with a family. The Microsoft Office family is a set

       of essential, full-featured programs for Windows. It includes

       Microsoft Word, Microsoft Excel, Microsoft Access(R), Microsoft

       PowerPoint(R), Microsoft Mail, Microsoft Project, and Microsoft

       Schedule+. It also includes Microsoft Office Standard and

       Professional, the most popular office suites on the market

       today.

       Consistency redefined. All programs in the Microsoft Office

       family look and work alike with common menus, commands, and

       toolbars. When you learn one program, you're well on your way

       to learning them all.

       Beyond ease of use. Only the programs in the Microsoft Office

       family have IntelliSense, built-in intelligence that

       anticipates what you want to do and responds with suggestions,

       examples, and shortcuts that reduce steps and save time.

       Routine tasks are automated and complex jobs become easier.

       Beyond cut and paste. Now it's truly easy to create, edit, and

       publish documents because OfficeLinks enable all programs in

       the Microsoft Office family to work together as if they were a

       single program. Move information between programs with a simple

       drag of the mouse. Edit information brought in from one program

       while you're working in another. And easily work with others in

       your group using built-in workgroup routing and editing

       features.

PERFORMANCE FEATURES

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

Basic Use

---------

 - 3-D workbooks and workbook tabs

 - AutoFill

 - AutoSum

 - AutoFit row and column width

 - Customizable toolbars

 - Drag-and-drop data movement

 - Function Wizard

 - Name box

 - Spelling checker

 - Tab dialog boxes

Learning Tools

--------------

 - ToolTips

 - Help floats on your screen

 - Online, context-sensitive Help

 - TipWizard

Drawing, Charting, Graphics, and Formatting

-------------------------------------------

 - AutoFormat

 - ChartWizard

 - Chart gallery, including user-defined charts

 - Ability to plot data by dragging it to your chart

 - Drawing tools on sheets and graphs

 - Error bars to show data uncertainty

 - Format Painter

 - Goal Seek for all chart types

 - Hands-on charting

 - Import graphics

 - Picture charts

 - Tear-off palettes

 - Trendlines and curve smoothing

Data Access and Analysis

------------------------

 - Analysis ToolPak with the most extensive financial, statistical,

   engineering, and scientific features of any spreadsheet

 - AutoFilter

 - Automatic subtotal

 - Data consolidation

 - Goal seeking

 - Microsoft Query

 - ODBC support

 - Outlining

 - PivotTable Wizard and PivotTable

 - Solver

 - TextWizard

Workgroup

---------

 - Auditing tools

 - Find File support

 - Route documents and send mail

 - Scenario Manager

 - Workgroup toolbar

Integration

-----------

 - Cross-program drag-and-drop data movement

 - Consistent toolbars and menus with other Microsoft Office programs

   for Windows

 - External graphic filters

 - OLE 2.0 support

Programming for All Users

-------------------------

 - On-sheet controls

 - Integrated dialog box editor

 - Network install

 - Macro recorder (in Visual Basic or Microsoft Excel 4.0 macro

   language)

 - Microsoft Visual Basic Programming System, Applications Edition

   installation

 - Custom install

 - Uninstall

2.  Q. How do I order my upgrade from Microsoft Excel version 4.0

       or earlier for Windows to Microsoft Excel version 5.0 for

       Windows?

    A. To order your Microsoft Excel 5.0 upgrade, call the Microsoft

       Sales Information Center at (800) 426-9400, Monday through

       Friday, between 6:30 A.M. and 5:30 P.M. Pacific time.

3.  Q. What are the minimum hardware and software requirements

       for Microsoft Excel version 5.0 for Windows?

    A. To run Microsoft Excel 5.0, you need the following:

        - MS-DOS operating system version 3.1 or later

          -and-

          any of the following (must be acquired separately):

          Microsoft Windows operating system version 3.1 or later

          Microsoft Windows for Workgroups version 3.1 or later

          Microsoft Windows for Pen Computing

          -or-

          Microsoft Windows NT(TM) version 3.1 or later

        - A personal computer with a 286 or higher microprocessor

        - 4 megabytes (MB) of memory

        - Hard disk space required:

          Laptop (minimum) installation: approximately 6 MB

          Typical installation: approximately 15 MB

          Custom installation: up to 22 MB

        - A 3.5-inch or 5.25-inch disk drive

        - EGA or higher-resolution monitor compatible with Microsoft

          Windows 3.1 or later

        - Microsoft Mouse or compatible pointing device (mouse

          recommended)

 4. Q. How do I install Microsoft Excel for Windows on a network

       server so that workstations can run Setup from the server?

    A. For detailed information about how to set up and administer

       Microsoft Excel on a network, see the NETWORK.TXT file on Setup

       Disk 1. To view and print this file:

       1. From the Accessories group in Program Manager, start

          Notepad.

       2. From the File menu, choose Open.

       3. Switch to the drive that contains your Microsoft Excel 5.0

          Setup disk, select NETWORK.TXT, and choose OK.

       4. From the Edit menu, choose Word Wrap.

       5. If you want to print the document, choose the Print command

          from the File menu.

5.  Q. When I run the Setup program for Microsoft Excel for

       Windows, there are several options to choose from. What do

       these options mean?

    A. When you run the setup program for Microsoft Excel 5.0, you can

       choose a Typical, Complete/Custom, or Laptop (Minimum) setup.

       Use the Complete/Custom option to choose some or all of the

       Microsoft Excel components. The components you can choose

       include: the Microsoft Excel program, Help files, Tutorial,

       Data Access, Graphics Filters, Add-ins, and Tools. To reduce

       the amount of disk space an option requires, select the option

       and choose the Change Option button. You can then select the

       components you want to install. The Complete/Custom option

       requires up to 23 MB. The Typical setup option installs

       everything except the Data Access component and requires

       approximately 19 MB. The Notebook setup option requires only 8

       MB because it installs only those files necessary to run

       Microsoft Excel.

6.  Q. If I run low on disk space, how do I uninstall specific

       components of Microsoft Excel for Windows?

    A. Once you've installed Microsoft Excel, you can run the Setup

       program at any time to add or remove supplementary applications

       or files. To run the Setup program:

       1. Quit Microsoft Excel if it is currently open.

       2. Double-click the Microsoft Excel Setup icon (this icon

          should be located in the same Program Manager group as your

          Microsoft Excel program icon).

       3. Choose the Add/Remove button.

       4. Clear the option check boxes for the components that you

          want to remove and select the items you want to add and

          choose the Continue button.

KBCategory: kbsetup kbappnote kbfasttip

KBSubcategory: xlquery

Additional reference words: 5.00 kbuage kbappnote


Excel: Calculating Weighted Averages

Article ID: Q109211

-------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

-------------------------------------------------------------------

SUMMARY

=======

A weighted average differs from an average in that a weighted average

returns a number that depends both on its value and its weight.

Consider the following example:

A shipment of 10 cases of widgets costs $0.20 per case.

Due to heavy consumption of widgets, a shipment of 40 cases now

costs $0.30 per case.

The average cost of these cases ($0.20+$0.30)/2 = $0.25 would not

be a accurate measure of the average cost of the cases since it

does not take into account that there are thirty more cases being

purchased at $0.30 than at $0.20. The weighted average would return

$0.28, a more accurate representation of the average cost of a case

of widgets.

MORE INFORMATION

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

To find a weighted average, do the following:

1. In a new worksheet, enter the following data:

   A1:  Cost     B1:  Cases

   A2:  $.20     B2:  10

   A3:  $.30     B3:  40

2. Follow the appropriate procedure below for your version of Microsoft

   Excel:

   Microsoft Excel Versions 4.0 and Later

   --------------------------------------

   Enter the formula below in any blank cell. It is NOT necessary to enter

   this formula as an array.

      =SUMPRODUCT(A2:A3,B2:B3)/SUM(B2:B3)

   Microsoft Excel Versions 2.x and 3.0

   ------------------------------------

   Enter the formula below as an array in any blank cell.

   =SUM(A2:A3*B2:B3)/SUM(B2:B3)

   NOTE: The above formula must be entered as an array formula. To enter a

   formula as an array formula in Microsoft Excel for Windows or Microsoft

   Excel for OS/2, press CTRL+SHIFT+ENTER. In Microsoft Excel for the

   Macintosh, press COMMAND+ENTER.

REFERENCES

==========

"Function Reference," version 4.0, page 424

"User's Guide 1," version 4.0, pages 153-166

"User's Guide," version 3.0 for Windows, pages 275-289

"User's Guide," version 3.0 for the Macintosh, pages 268-281

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0

3.00 4.0 4.00 4.0a 4.00a 5.0 5.00  m_excel


XL: Cannot Open Microsoft Works 3.0 or 4.0 Files

Article ID: Q109246

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed above, you cannot open files

saved in the Microsoft Works 3.0 or 4.0 format.

WORKAROUND

==========

In order for Microsoft Excel versions 5.0 and later to open a file saved

from Microsoft Works 3.0 or 4.0, the file must first be saved in a

compatible file format. To do this in Microsoft Works for Windows version

3.0, do the following:

1. Open the file that you want Microsoft Excel to be able to open.

2. From the File menu, choose Save As.

3. From the Save File As Type list, select one of the following file

   formats:

   Format                                  Saves File with Extension

   -----------------------------------------------------------------

   Works for Windows 2.0/                  WKS

   Works for DOS SS

   Excel 4.0/5.0 SS                        XLS

   Lotus 1-2-3                             WK1

4. Choose OK to save the file in the new format.

5. Close the file before you attempt to open it in Microsoft Excel.

You should now be able to open the file in Microsoft Excel.

This information also applies to Microsoft Works version 3.0 for MS-DOS and

Microsoft Works version 3.0 and 4.0 for the Macintosh. In these versions of

Microsoft Works, use the appropriate steps to save the file in either one

of the above file formats or in the symbolic link (SYLK) file format (which

is also compatible with Microsoft Excel version 5.0).

MORE INFORMATION

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

When you open a file in the versions of Microsoft Excel listed above, the

List Files Of Type list indicates that one of the file types Microsoft

Excel can open is

   Microsoft Works Files (*.WKS)

Even though no version information is mentioned, Microsoft Excel can

only open Microsoft Works files saved in the Microsoft Works 2.0 (or

earlier) format. You cannot open Microsoft Works 3.0 or 4.0 files directly

in Microsoft Excel.

If you attempt to open a Microsoft Works 3.0 file, you will receive

the following error message:

   Cannot read this binary file. If the file was created in a version

   of Microsoft Excel later than 5.0, use that version to save it as a

   Microsoft Excel 5.0 file. Open file as text?

If you open the file as text, it will be virtually unreadable.

To open a file saved from Microsoft Works version 3.0, you must first save

it in a file format compatible with Microsoft Excel version 5.0.

KBCategory: kbinterop

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Dates in Pivot Table May Be Converted into Text

Article ID: Q109420

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed in the beginning of this article,

if you create a pivot table that uses dates as row or column fields, the

dates will be converted to text. Because of this conversion, you may have

difficulty sorting or otherwise manipulating these dates.

Note that this situation may also apply if you use times as row or column

fields.

MORE INFORMATION

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

This conversion occurs because of the way pivot tables are constructed.

Microsoft Excel assumes that pivot table labels will not be used as

anything but labels, therefore, all of the label items are converted to

text before they are placed into the pivot table.

If you use dates in the row or column fields, they will be converted into

text strings that resemble dates. To convert these text versions of dates

(or times) back into dates (or times), do the following:

1. In a blank cell, type "1" (without the quotation marks).

2. Copy the cell containing the "1" by choosing Copy from the Edit menu.

3. Select the cells that contain the dates that you want to convert.

4. From the Edit menu, choose Paste Special.

5. In the Paste Special dialog box, under Paste, select Values, and under

   Operation, choose Multiply. Choose OK.

The dates now appear as serial numbers (32645, 32647, and so on).

6. From the Format menu, choose Cells.

7. Select the Number tab.

8. From the list of Format Codes, select the desired date format.

9. Choose OK to accept the change.

The text versions of the dates have now been converted to dates that you

can sort and format.

REFERENCES

==========

"User's Guide," version 5.0, pages 470-474

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: Formatting Dialog Frame When Sheet Protected Hangs Excel

Article ID: Q109422

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel version 5.0 for Windows, if you choose Object from the

Format menu and if the following three conditions are true

 - The dialog frame is not locked,

   -and-

 - The dialog frame is the currently selected object,

   -and-

 - The dialog sheet is protected,

Microsoft Excel will hang and you will receive the following error message:

   Application Error

   integer divide by 0

WORKAROUND

==========

If your dialog sheet is protected, and if the dialog frame is the currently

selected object, do not choose Object from the Format menu.

Note that you can format other objects in the dialog sheet even if the

dialog sheet is protected.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows 95, version 7.0.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00 crash hang stop responding quit


XL: Not Possible to Position Custom Dialog Boxes

Article ID: Q109423

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed at the beginning of this article,

it is not possible to directly affect the on-screen position of a custom

dialog box when it is displayed.

NOTE: A note at the top of page 225 in the Visual Basic "User's Guide,"

version 5.0, states that you can cause a custom dialog box to appear at a

specific location . . . ." This information is incorrect.

MORE INFORMATION

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

The DialogFrame.Left and DialogFrame.Top properties can be used to change

the position within a dialog sheet of a dialog frame. However, changing

these properties does not affect the on-screen position of a custom dialog

box when you show it by using the DialogSheets("Dialog1").Show method.

In Microsoft Excel, when a dialog box is shown, its upper-left corner will

be located in the same position as the upper-left corner of the last dialog

box shown.

Other dialog boxes, such as the Open and Save As dialog boxes, follow the

same rule. For example, when the Open dialog box is visible and you choose

the OK button to remove it, the next dialog box that appears on the screen

will appear with its upper-left corner in this same position.

NOTE: If, when you display a dialog box, part or all of the dialog box is

pushed off the edge of the screen, Microsoft Excel automatically shifts the

dialog box so that the whole dialog box is visible.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: How to Use the Help Button in Custom Dialog Boxes

Article ID: Q109424

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you format dialog box buttons, it is possible to

format one button in the dialog box as a Help button. The Help button has

special functionality assigned to it that allows you to summon help by

pressing the F1 key.

MORE INFORMATION

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

To assign the Help attribute to a button in a dialog box, do the following:

1. Select the button.

2. From the Format menu, choose Object.

3. Select the Control tab.

4. Select the Help check box.

5. Choose OK to accept the change.

Note that only one button in a dialog sheet can be the Help button: if you

assign another button to be the Help button, the original Help button loses

the Help attribute.

When you assign a button to be the Help button, that button will be

activated when you press the F1 key while the dialog box is active.

To use the Help button feature, you should assign the Help button to run a

subroutine that displays some sort of help topic, such as a .HLP file.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00


XL: Update Remote References Option Selected by Default

Article ID: Q110006

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you open a workbook in Microsoft Excel version 5.0, the Update Remote

References calculation setting for the workbook is usually selected. The

exception to this rule occurs when a workbook has been linked to an

external data source and you do not allow Microsoft Excel to update links

to the external data source.

MORE INFORMATION

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

The Update Remote References calculation setting determines whether

or not Microsoft Excel updates formulas that include references to

external data sources (such as Microsoft Word for Windows documents

or Microsoft Access databases). Note that Microsoft Excel workbooks

and documents are NOT external data sources.

When you open a workbook, the Update Remote References setting will be set

according to the following table:

                                           Update Remote

   Condition                               References Check Box

   ------------------------------------------------------------

   Workbook not linked to any other        Selected

   documents

   Workbook linked to other workbooks      Selected

   or Microsoft Excel documents

   Workbook linked to external data        Cleared (not selected)

   source and you select No when you

   receive the prompt "This document

   contains links. Re-establish links?"

   Workbook linked to external data        Selected

   source and you select Yes when you

   receive the prompt "This document

   contains links. Re-establish links?"

To clear the Update Remote References setting in the active workbook:

1. From the Tools menu, choose Options.

2. Select the Calculation tab.

3. Clear the Update Remote References check box.

4. Choose OK to accept the change.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

The following Visual Basic code example assumes that you have a file called

TEST.XLS, which is located in the C:\EXCEL directory. The example opens the

TEST.XLS file and then clears (turns off) the Update Remote References

check box. As the subroutine opens the file, it also prevents Microsoft

Excel from updating any of the workbook's external or remote references.

'----------------------------------------------------------------------

Sub Example()

   'The zero after updateLinks indicates that neither external nor

   'remote references should be updated when the file is opened.

   Workbooks.Open fileName:="C:\EXCEL\TEST.XLS", updateLinks:=0

   'Turn off the Update Remote Referencessetting for the workbook.

   ActiveWorkbook.UpdateRemoteReferences = False

End Sub

'----------------------------------------------------------------------

Note that the Update Remote References check box is not a universal

setting: if two workbooks are open, one workbook can have its Update Remote

References setting selected, while in the other workbook the check box is

cleared. However, when you open a workbook, its Update Remote References

check box will be selected, no matter how it was saved, unless it contains

links to an external data source.

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00 calc


XL Err Msg: "Setup Needs To Modify A File" During Setup

Article ID: Q110074

------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

------------------------------------------------------------

SYMPTOMS

========

When you run the Microsoft Excel Setup program, you may receive one of the

following error messages after you enter your information in the Name And

Organization Information dialog box:

   Serious disk error writing to drive A:

   -or-

   Setup Needs To Modify a file on:

      A:\

   If you have locked your disk with a write-protect tab, please unlock it

   and then choose OK.

If you receive the second error message and then choose OK, you receive the

same error message. If you choose Ignore, you receive the following error

message:

   Could not write to the file named: 'A:\SETUP.INI'. Please verify that

   the destination drive has enough disk space."

CAUSE

=====

During Microsoft Excel Setup, your name and organization information is

written to the Setup Disk 1. You receive the error message above if Setup

Disk 1 is write-protected because information cannot be written to the

disk. If you are using 3.5-inch disks, the disk is write-protected if the

write-protect window on the disk is open.

NOTE: It is possible for the write-protect tab to slip during the shipping

and handling of your disks.

WORKAROUND

==========

To work around this problem, do one of the following:

 - If you still have the error message on the screen:

   1. Eject Setup Disk 1 from your floppy disk drive.

   2. Close the write-protect window if you are using 3.5-inch disks or

      remove the write-protect tab if you are using 5.25-inch disks.

   3. Place Setup Disk 1 back in your floppy drive.

   4. In the error message dialog box, choose OK or Retry (depending on

      which error message is on the screen).

   -or-

 - If you have exited the Microsoft Excel Setup program:

   1. Eject Setup Disk 1 from your floppy drive.

   2. Close the write-protect window if you are using 3.5-inch disks, or

      remove the write-protect tab if you are using 5.25-inch disks.

   3. Place Setup Disk 1 back in the floppy drive.

   4. Run Setup again.

KBCategory: kbsetup

KBSubcategory: xlwin

Additional reference words: 5.00 5.00c 7.00 ensure b:\ full modify

setup.inf Word word6


XL: ShowDataForm Method Fails If Data Can't Be Found

Article ID: Q110462

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel version 5.0, when you use the Visual Basic ShowDataForm

method, you may receive the following error message:

   Run-time error '1004':

   ShowDataForm method of Worksheet class failed

CAUSE

=====

This error occurs because Microsoft Excel is unable to find a data list on

the worksheet you specified in the Visual Basic statement.

When you use the ShowDataForm method, Microsoft Excel looks for the data

list in two places:

 - The defined name "Database." If a range has been defined as the

   database, Microsoft Excel will display the data form, and the data in

   that range will be accessible.

 - Cells A1:B2 on the specified worksheet. Microsoft Excel will attempt

   to find a list whose upper-left corner lies in the range A1:B2. If a

   list is found, Microsoft Excel will display the data form and the data

   in the list will be accessible.

WORKAROUNDS

===========

To work around this problem, define your data with the defined name

"database" or move your data so that its upper-left corner is located in

the range A1:B2.

To define your data with the defined name "database"

----------------------------------------------------

1. Select the range that contains your data.

2. From the Insert menu, choose Name, and then choose Define.

3. In the Name box, type "<Sheetname>!Database" (without the quotation

   marks), where <Sheetname> is the name of the active worksheet.

4. Choose OK to accept the change.

When you execute the ShowDataForm method and specify the worksheet,

the data form will be displayed with the correct data.

To automate the above process, select the data that you want to be included

in your database (including column headings), and include the following in

your Visual Basic procedure:

   ActiveWorkbook.Names.Add Name:=ActiveSheet.Name & _

      "!Database", RefersToR1C1:=Selection

   Worksheets(1).ShowDataForm

MORE INFORMATION

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

The Visual Basic ShowDataForm method is used to display a data form. You

can use a data form to view a list of data or to enter new data into a

list. You might use the ShowDataForm method in one of the following ways:

   ActiveSheet.ShowDataForm

   -or-

   Worksheets("Sheet1").ShowDataForm

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Chart Trendline Equation or Data Label Disappears

Article ID: Q110499

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, if you move a data label or a trendline equation

on a chart, that label or equation may disappear when you change the

data that the chart was created from.

CAUSE

======

When you move a data label or a trendline equation on a chart, the distance

you move (offset) the label or equation is stored and is used when you

change the data in the chart. You cannot detach a data label or trendline

equation from a data point: the label or equation moves relative to the

changing data. This relative movement may cause your data labels or

trendline equations to move off of the chart area when you change the data

you created your chart from.

WORKAROUNDS

===========

To Restore a Data Label or Trendline Equation

---------------------------------------------

To restore a data label or a trendline equation that has disappeared

because your chart data changed, do the following:

1. Select the plot area for the chart.

2. Drag one of the corner handles on the selected plot area in to scale

   your chart to a smaller size.

3. Select the label or equation that is located outside the plot area (that

   part that was previously hidden) and drag it back to the plot area.

4. Select the chart plot area, and drag one of the corner handles on the

   selected plot area to scale the chart back to the original size.

To Restore a Trendline Equation Only

------------------------------------

To restore a trendline equation that has disappeared because of

changing chart data, you can use the above workaround, or you can

remove the trendline equation and add it back as follows:

1. Select the trendline on your chart.

2. From the Format menu, choose Selected Trendline.

3. Select the Options tab, and clear the Display Equation On Chart check

   box. Choose OK.

4. From the Format menu, choose Selected Trendline.

5. Select the Options tab, and select the Display Equation On Chart check

   box. Choose OK.

REFERENCES

==========

For an Overview Of Adding A Trendline To A Data Series, choose the

Search button in Help and type:

    trendlines

For more information about Adding Data Labels, Changing Data Labels,

or Creating Data Labels, choose the Search button in Help and type:

    labels, data

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Pivot Table Uses COUNT Instead of SUM with Blank Cells

Article ID: Q110599

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

Microsoft Excel automatically uses the SUM function for numeric data and

the COUNT function for non-numeric data in the Data area of a pivot table.

If the numeric field contains blank cells, the PivotTable Wizard will

default to COUNT instead of SUM. If all value cells contain numbers, the

default will be SUM as expected.

If you want to change the function that's used in the data field, do the

following:

1. In the PivotTable Wizard Step 3 of 4 in the Data field, double-click the

   field button.

2. From the Summarize By List box, choose Sum.

3. Choose OK.

STEPS TO REPRODUCE:

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

1. Open a new workbook.

2. Enter the following:

  a1 region   b1 salesperson  c1 sales

  a2 a        b2 joe          c2 1

  a3 b        b3 cindy        c3

  a4 c        b4 tom          c4 1

  a5 d        b5 steve        c5

3. Select any cell in the range a1:c5 and from the Data menu select

   PivotTable.

4. Select Next in Step 1 of 4 of the PivotTable Wizard. In Step 2 of 4

   select Next to accept the range a1:c5.

5. Drag the Region field button to the row area, drag the Salesperson

   field button to the column area, and drag the Sales field button to the

   data area. Notice the Sales field button changes to Count of Sales.

6. Double Click on the Count of Sales field button in the data area.

   Choose to Summarize by Sum and click Ok. The caption changes to Sum of

   Sales.

7. Click Finish in Step 3 of 4 to create your PivotTable.

REFERENCES

==========

"User's Guide," version 5.0, Chapter 24

For more information about Pivot Tables, choose the Search button in

Help and type:

    Pivot

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 pt


XL: Pivot Table Refresh Overwrites Formatting

Article ID: Q110602

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you apply formatting to individual cells in a pivot table, this

individual formatting will be lost when the pivot table data is refreshed.

WORKAROUND

==========

To change the automatic pivot table formatting, which is applied in the

last step of the Pivot Table Wizard, do the following to apply an

autoformat to the table:

1. From the Format menu, choose AutoFormat.

2. From the Table Format box, choose an autoformat.

3. Choose OK.

Refreshing the data will not change the applied autoformat.

Note that if other cells not contained within the pivot table are included

in the AutoFormat process, formatting will be lost from the pivot table

when the data is refreshed. To prevent this from occurring, make sure that

the autoformatting applied to the pivot table is not also applied to

adjacent cells.

REFERENCES

==========

"User's Guide," version 5.0, Chapter 25

For more information about formatting pivot tables, choose the Search

button in Help and type:

   Pivot Tables

For more information about AutoFormat, choose the Search button in

Help and type:

   AutoFormat

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 pivottable pt auto format formatting


XL: Setting Initial Values When Running Built-In Dialog Box

Article ID: Q110670

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you use a Visual Basic procedure to run a

built-in dialog box, you must know the correct order of the arguments

for the corresponding macro function if you want to set initial

values in the dialog box. For example, to set initial values in the

Save As dialog box, you must know the order of the arguments for the

SAVE.AS macro function.

In addition, when you set initial values in the dialog box, you must

either use arguments in their correct order, using commas as

placeholders for omitted arguments, or use the Show method named

arguments arg1, arg2, through arg30, to specify the order of the

arguments.

The named arguments arg1, arg2, through arg30, are for built-in dialog

boxes only; they provide the initial values for the dialog box.

MORE INFORMATION

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

In Visual Basic, arguments names are defined for properties and

methods. Because the arguments are named, you can list them in any

order or omit arguments without leaving commas as a placeholders.

Using Named Arguments

---------------------

For example, the following is the syntax for the SaveAs method

    object.SaveAs(filename, fileFormat, password, writeResPassword,

                   readOnlyRecommended, createBackup)

where the SaveAs method arguments are listed in the parentheses.

The following is an instruction in Visual Basic that uses this method

with only the filename and createBackup arguments:

   ' Using Named arguments

   ActiveWorkbook.SaveAs createBackup:=True, FileName:="BUDGET.XLS"

Note that you do not have to list the arguments in any particular

order, and you do not have to use commas as placeholders for the

omitted arguments.

To Display a Built-In Dialog Box with Initial Values

----------------------------------------------------

If you use the Show method to display the Save As dialog box, you

must know the order of the arguments for the corresponding Save.As

macro command to set initial values in the dialog box.

The syntax for the Save.As macro command is the following

   SAVE.AS(document_text, type_num, prot_pwd, backup, write_res_pwd,

           read_only_rec)

where the arguments are included in the parentheses in their correct

order. If you want display the Save As dialog box with only the

document_text and backup initial values set, you must indicate the

missing arguments with commas, or use the named arguments arg1, arg2,

through arg30 to specify the correct order.

To display the Save As dialog box with BUDGET.XLS in the File Name

box and the Always Create Backup option selected as initial values,

use either of the methods below:

Using Commas As Placeholders

----------------------------

' Using arguments in correct order with commas as placeholders

Application.Dialogs(xlDialogSaveAs).Show "BUDGET.XLS", , , True

The extra commas after the filename value are placeholders for the

missing arguments.

Note that if you use commas as placeholders for missing arguments,

trailing commas at the end of an instruction can be omitted. In the

example above, it is not necessary to add additional commas after the

final argument used (backup).

-or-

Using Show Method Named Arguments

---------------------------------

' Using arg1, arg2, ... arg30 to provide the position of arguments

Application.Dialogs(xlDialogSaveAs).Show arg1:="BUDGET.XLS", arg4:=True

REFERENCES

==========

To display a list of all the Microsoft Excel macro functions and

their arguments in the correct order, do the following:

1. In Microsoft Excel, from the Help menu, choose Contents.

2. From the list of topics, select Reference Information.

3. Under General Reference, select Microsoft Excel Macro Functions

   Contents.

4. From the list of topics, select Alphabetical List Of Macro Functions or

   Macro Functions Listed BY Category.

For more information about the Dialog Object or the Show Method,

choose the Search button in Help and type:

    built-in dialog boxes

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Returning Multiple Values from a Custom Function

Article ID: Q110693

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed at the beginning of this article,

there are two different methods of returning multiple values from a custom

function: one for returning a variable-sized array and one for returning a

fixed-size array.

The following Visual Basic code examples demonstrate each of these methods.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

Method to return a variable-size result array

---------------------------------------------

This method returns an array of values based on an argument range. The size

of the resulting array will fluctuate depending on the number of elements

in the argument array. For example, assume that you want to create a

function that will multiply each value in a range by 100. The following

custom function will accept an array (a range of values) as its argument:

   Function Multiply_Range(myrange As Object) As Variant

     Dim temp As Variant

     Dim i As Integer, j As Integer

     temp = myrange.Value 'creates a copy of the values in myrange

     ' if more than one element then loop through both dimensions of the

     ' array and multiply each element by 100.

     ' if not more than one element then temp is multiplied by 100.

     If IsArray(temp) Then

         For i = 1 To UBound(temp, 1)

             For j = 1 To UBound(temp, 2)

                 temp(i, j) = temp(i, j) * 100

             Next j

         Next i

     Else

         temp = temp * 100

     End If

     Multiply_Range = temp

   End Function

To use the custom function, select the range B1:B4 and enter the

following formula as an array:

   A1:     5       B1:     {=Multiply_Range(A1:A4)}

   A2:     3       B2:     {=Multiply_Range(A1:A4)}

   A3:     1       B3:     {=Multiply_Range(A1:A4)}

   A4:     2       B4:     {=Multiply_Range(A1:A4)}

The result will be:

   A1:     5       B1:     500

   A2:     3       B2:     300

   A3:     1       B3:     100

   A4:     2       B4:     200

NOTE: The above formula must be entered as an array formula. To enter a

formula as an array formula in Microsoft Excel for Windows, press

CTRL+SHIFT+ENTER.

Method to Return Array Result of a Fixed Size

---------------------------------------------

This method for returning multiple values from a custom function assumes

that you will have a fixed number of elements in the resulting array.

The following custom function will accept a starting time and an ending

time and return the number of hours, minutes, and seconds between them in a

3-row by 1-column array.

   Function Elapsed_Time(start, finish As Date) As Variant

      Dim hours, minutes, seconds As Integer

      hours = Hour(finish - start)

      minutes = Minute(finish - start)

      seconds = Second(finish - start)

      Elapsed_Time = Application.Transpose(Array(hours, minutes, seconds))

   End Function

To use this custom function, enter a starting time and a finish time

in two cells (for example, A1 and A2 below). Then, highlight three

cells in a column (for example, A3 through A5 below) and enter the

following as an array formula:

   A1:     1:00:00

   A2:     6:49:34

   A3:     {=Elapsed_Time(A1,A2)}

   A4:     {=Elapsed_Time(A1,A2)}

   A5:     {=Elapsed_Time(A1,A2)}

The result will appear as follows:

   A1:     1:00:00

   A2:     6:49:34

   A3:     5

   A4:     49

   A5:     34

NOTE: The above formula must be entered as an array formula. To enter a

formula as an array formula in Microsoft Excel for Windows, press

CTRL+SHIFT+ENTER.

If you prefer to enter the function horizontally into a range

of cells instead of a vertically, change the Elapsed_Time line to

read:

   Elapsed_Time = Array(hours, minutes, seconds)

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, Chapter 3

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Visual Basic Example to Delete Blank Rows

Article ID: Q110759

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The following Visual Basic code locates blank cells within a range and

deletes the entire row that contains that cell. The code brings up a dialog

box that prompts the user for the total number of rows to process. The

macro begins at the active cell and moves down the specified number of

rows.

Visual Basic Example

--------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

'The following code deletes blank rows from the active worksheet.

Option Explicit

Dim Count

Dim i As Integer

Sub DelRow()

'Input box to determine the total number of rows in the worksheet.

Count = InputBox("Enter the total number of rows to process")

'Loops through the desired number of rows.

For i = 1 To Count

    'Checks to see if the active cell is blank.

    If ActiveCell = "" Then

        Selection.EntireRow.Delete

        'Decrements count each time a row is deleted. This ensures

                'that the macro will not run past the last row.

        Count = Count - 1

    Else

        'Selects the next cell.

        ActiveCell.Offset(1, 0).Select

    End If

Next i

End Sub

NOTE: you can also delete lines that contain spaces or other non-display

characters. To do this, change the line that reads

   If ActiveCell = "" Then

   -to-

   If Len(Trim(ActiveCell)) = 0 Then

and those lines will also be deleted.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


Computing Periodic Annual Interest Rate in Microsoft Excel

Article ID: Q110854

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 2.x, 3.0, 4.0, 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

The RATE() function in Microsoft Excel, and the @RATE function in

Lotus 1-2-3 both return the periodic interest rate necessary for an

investment to grow to a specific value over a specified number of

compounding periods. However, in Microsoft Excel, RATE() assumes a

known stream of payments. If the payment amount per period is not

known, you can still the RATE() function, but you must modify it

slightly.

A manually entered formula must be used to determine the annualized

interest rate for an investment with more than one compounding period per

year. You can also use a custom function to make this calculation easier.

MORE INFORMATION

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

To use the RATE() function in Microsoft Excel when the payment per period

is not known, you must enter the number of compounding periods, the present

value as a negative number, and the future value.

For Example, an initial investment of $1,000, that has grown to $2,000 when

compounded quarterly over six years would return 2.93% per quarter when

entered as follows:

   =RATE(24,,-1000,2000)

To determine the annualized interest rate for an investment, use the

following formula

   =((FV/PV)^(1/N)^M)-1

where FV is the future value of an investment, PV is the initial

investment, N is the total number of compounding periods, and M is the

number of compounding periods per year.

The following formula, when used with the numbers from the previous

example, will return 12.2462% per year:

   =((2000/1000)^(1/24)^4)-1

To create a function macro in version 5.0

-----------------------------------------

To create this function using Visual Basic, Applications Edition, enter the

following in a new Visual Basic module:

   Function Yearly_Rate(FV, PV, N, M) As Double     'Defines variables

       Yearly_Rate = ((FV / PV) ^ (1 / N)^M) - 1    'Performs computation

   End Function                                     'Ends function

To use the custom function:

1. Enter the following values on a worksheet:

   A1:   20000

   A2:   10000

   A3:      72

   A4:      12

2. In any blank cell, enter the following formula:

   =Yearly_Rate(A1,A2,A3,A4)

The annual interest rate returned is 12.2462%.

To create a function macro for versions 2.x, 3.0 and 4.0

--------------------------------------------------------

You can use a custom function in Microsoft Excel to compute the

annual interest rate. To create this function enter the following in

a Microsoft Excel macro sheet:

   B1:  Yearly_Rate

   B2:  =RESULT(1)

   B3:  =ARGUMENT("FV",1)

   B4:  =ARGUMENT("PV",1)

   B5:  =ARGUMENT("N",1)

   B6:  =ARGUMENT("M",1)

   B7:  =RETURN((((FV/PV)^(1/N)^M))-1)

After entering the above formulas on a Microsoft Excel macro sheet, define

it as a function macro. For information on defining function macros see the

Microsoft Excel User's Guide 2, pages 203-213.

Example

-------

To compute the periodic interest rate for a $10,000 investment that

matures in six years, compounded monthly, with a maturity value of

$20,000, do the following:

1. Enter the following on a Microsoft Excel worksheet:

      A1:   20000

      A2:   10000

      A3:      72

      A4:      12

2. Select cell B1,  choose Paste Function from the formula menu.

3. Select the User Defined category, and then scroll to the bottom of the

   Paste Function list.

4. Choose your custom function and choose the OK button.

   If the custom function macro is placed on a sheet named "RATE.XLM", the

   following formula will appear in cell B1.

   =RATE.XLM!Yearly_Rate(FV,PV,N,M)

5. Enter the values "A1", "A2", "A3", and "A4" (without the quotation

   marks)in place of the arguments in the formula (FV, PV, N, and M) and

   press ENTER.

The annual interest rate 12.2462% is returned.

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, pages 41-48

"User's Guide 2," version 4.0, pages 203-213

"Function Reference," version 4.0 pages 347-348

"Lotus 1-2-3 for DOS 2.3, @Functions and Macro Guide," Pages 69-70

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.0 3.0 4.0 4.0a 5.0 growth


XL5: Startup Directory Is XLSTART Not PERSONAL.XLS

Article ID: Q110855

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

On page 23 of the "Visual Basic User's Guide," the second paragraph states

the following:

   Then the workbook is stored in the startup directory or folder named

   PERSONAL.XLS (in Microsoft Excel for Windows) or PERSONAL MACRO

   WORKBOOK (in Microsoft Excel for the Macintosh).

This statement is misleading. The startup directory in Microsoft Excel for

Windows is named XLSTART not PERSONAL.XLS. The startup folder in Microsoft

Excel for the Macintosh is named "EXCEL STARTUP FOLDER (5)", not "PERSONAL

MACRO WORKBOOK".

MORE INFORMATION

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

The statement should state the following:

   Then the workbook is stored in the startup directory or folder and

   is named PERSONAL.XLS (in Microsoft Excel for Windows) or PERSONAL

   MACRO WORKBOOK (in Microsoft Excel for the Macintosh).

PERSONAL.XLS (in Microsoft Excel for Windows) and PERSONAL MACRO WORKBOOK

(in Microsoft Excel for the Macintosh) is a hidden workbook used to store

macros that you want to use in a variety of workbooks.

For more information about using these workbooks, see page 22 in the

"Visual Basic User's Guide" for Microsoft Excel version 5.0.

KBCategory: kbdocerr

KBSubcategory:

Additional reference words: 5.00 5.00a 5.00c docerr err error start-up

start up


XL5: Defining Name in Name Box Causes Type Mismatch Error

Article ID: Q110857

--------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, if you enter a name in the name box on the formula bar

and that name is one of the constants reserved for a Visual Basic module

sheet, you may receive the following error message:

   Microsoft Excel: Type Mismatch

You will have the option to choose OK or Help. If you choose OK the name is

created successfully.

MORE INFORMATION

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

In the Microsoft Visual Basic Programming System, Applications Edition,

several predefined constants make programming easier. These constants are

descriptive and can be used as parameters in functions and methods in a

Visual Basic macro.

Choosing the Help button in the error message dialog box brings up Visual

Basic Help and displays the Type Mismatch (Error 13) topic. The information

in this help topic does not mention reserved constants as a possible cause

for this error message.

WORKAROUND

==========

This problem does not occur when you use the Name command on the Insert

menu to define a name.

REFERENCES

==========

"User's Guide," version 5.0, Chapter 10, "Names Make References Easier to

Use"

For more information about the name box, choose the Search button in

Help and type:

    name box

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00 7.00


XL Err Msg: Not Enough Memory To Display Pivot Table

Article ID: Q110890

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you create a pivot table, or add a column

field to an existing pivot table, you may receive the following error

message

   Not enough memory to completely display pivot table.

and the pivot table is not created or the column field is not added.

CAUSE

=====

This error message appears when you add too many column fields to the

pivot table. The number of column fields that you can add to a pivot

table varies with the amount of data in the pivot table and the

memory available on your computer.

WORKAROUND

==========

When you create a pivot table, limit the number of column fields you

use to three or four, especially when you create the pivot table from

a large database. When you need to create a pivot table with a large

number of fields, use row fields. Because row fields do not use as

much memory as column fields, you will be able to add more row fields

to your pivot table than column fields.

MORE INFORMATION

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

You can add a row or column field to an existing pivot table using

the shortcut menu by doing the following:

1. Select a cell in the pivot table, and click the right mouse button.

2. From the shortcut menu, choose Add Row Field or Add Column Field, and

   then choose the field you want to add as a row or column field in your

   pivot table.

REFERENCES

==========

For an Overview Of Creating A Pivot Table, choose the Search button

in Help and type:

   pivot tables, creating

KBCategory: kberrmsg

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: Error Messages When Accessing Files from Floppy Disks

Article ID: Q110944

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

When you access a file directly from a floppy disk, you may receive an

error message if you remove the disk from the drive while the file is still

open.

NOTE: The information in this article assumes that you are using a single

floppy disk drive. If your computer has two or more floppy disk drives,

this information applies only if you remove a disk from a certain disk

drive (for example, drive A) and insert another floppy disk into the same

floppy disk drive.

Error Messages You May Receive When You Open a File

---------------------------------------------------

In Microsoft Excel, if you attempt to open a file from a floppy disk, you

may receive one of the following error messages

   Cannot access '<drive>:'

   -or-

   A different disk is expected in drive <drive>:

where <drive> is your computer's floppy disk drive.

Error Messages You May Receive When You Save a File

---------------------------------------------------

If you attempt to save the file back to the same floppy disk, and if that

disk that has been removed from the disk drive, you may receive the error

message:

   Filename is not valid

If you include the drive letter in the file name when you save the file,

you receive the following error message

   Cannot access '<drive>:<filename>'

where <drive> is your floppy disk drive and <filename> is the name of your

document.

In Windows 95, if you open a file from a disk, and you insert a different

disk in the disk drive, when you attempt to save the file to the disk, you

receive the following error message

   Error Reading Disk in Drive <drive>

   Please Insert Disk <label>

   With Serial Number <serial number> in Drive <drive>:

where <drive> is your computer's floppy disk drive, and <label> and <serial

number> are the label and serial number of the original disk.

CAUSE

=====

Microsoft Excel for Windows can run only when a file-sharing program, such

as SHARE.EXE or VSHARE.386, is running.

The error messages occur because of the way in which SHARE.EXE and

VSHARE.386 keep track of open files. When you open a file from a floppy

disk, the serial number (if one exists) of the floppy disk (for example,

2B4A-1ACA), is read into memory. If you attempt to open a file from a

floppy disk that has a different serial number while the first file is

still open, you will receive an error message.

Note also that a disk formatted with the FORMAT command (included with MS-

DOS versions 5.0 and later) will be assigned a serial number.

WORKAROUNDS

===========

If your files are stored on floppy disks that do not have serial numbers,

you may be able to open files without receiving an error message.

Opening Files from Floppy Disks

-------------------------------

To avoid receiving an error message when you open files from floppy disks,

copy the files to your hard disk drive before you open them.

This is the recommended workaround because opening files from and saving

files to the hard disk drive is faster than using a floppy disk drive; in

addition, saving to the hard disk drive allows you to avoid problems caused

by lack of space on floppy disks.

Other Ways to Avoid Getting These Error Messages

------------------------------------------------

 - Use a third-party disk formatting program, such as the SFORMAT (Safe

   Format) program included with Symantec's Norton Utilities, to format

   your floppy disks. These programs often do not place a serial number

   on floppy disks.

   -or-

 - Format the floppy disks in a computer running MS-DOS 4.0 or earlier.

   Versions 2.x, 3.x, and 4.0 of MS-DOS do not place serial numbers

   on floppy disks when they are formatted.

Saving a File to a Different Floppy Disk

----------------------------------------

If you open a file from a floppy disk and then remove that floppy disk from

the disk drive before you close the file, you may receive the error message

"Filename is not valid" when you choose Save from the File menu. This error

message will appear if the path for the new file is not applicable to the

new floppy disk.

For example, if you open the file A:\Test\Alpha.xls, remove the floppy

disk from drive A, and then insert a new disk into drive A, choosing Save

from the File menu will only work if there is a TEST directory on drive A.

MORE INFORMATION

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

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q118958

   TITLE     : XL5: Excel 5.0c Setup Program Installs VSHARE.386

   ARTICLE-ID: Q106499

   TITLE     : XL5 Err Msg: "Must Exit Windows and Load SHARE.EXE..."

KBCategory: kbprb

KBSubcategory: xlwin projwin

Additional reference words: 5.00 7.00 switch switching change changing

blue screen


XL OLE Automation: Workbook Hidden Using GetObject Function

Article ID: Q111247

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

If you use the GetObject function in a Microsoft Visual Basic version

3.0 procedure to open and save a Microsoft Excel workbook, the

workbook is saved as hidden and does not appear when you open the

workbook again.

WORKAROUND

==========

To avoid saving a workbook as hidden when you use the GetObject

function in a Visual Basic procedure to open and save the workbook,

unhide the workbook before saving it, as in the following Visual Basic

procedure:

   ' Dimension variable xl as Object type

   Dim xl As Object

   ' Set xl equal to Excel workbook as OLE Automation object

   ' and open file BOOK1.XLS located in c:\excel5

   Set xl = GetObject("C:\excel5\book1.xls")

   ' Make the hidden workbook visible

   xl.Parent.Windows("BOOK1.XLS").Visible = True

   ' Save the file BOOK1.XLS

   xl.Parent.Save

   ' Close the file BOOK1.XLS

   xl.Parent.[Close]

   ' Free the memory used for storing xl variable

   Set xl = Nothing

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide.

MORE INFORMATION

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

Note that the above behavior also occurs when you use the CreateObject

function in a Visual Basic, Applications Edition, procedure to open and

save a Microsoft Excel workbook. However, because Microsoft Excel has an

object library, use the functions defined in that library rather than the

GetObject or CreateObject function when you access Microsoft Excel objects

in a Visual Basic, Applications Edition, procedure.

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00 3.00 B_VBasic


XL: Status Bar Text for Toolbar Button Changes Unexpectedly

Article ID: Q111269

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

The text that appears in the status bar when the mouse pointer is

positioned over a toolbar button in Microsoft Excel version 5.0 may revert

to a default value unexpectedly.

CAUSE

=====

This change in the status bar occurs when the macro assigned to that

toolbar button is also assigned to another button.

WORKAROUND

==========

To keep the problem from occurring, save changes to the document after

you assign status bar text to a macro.

MORE INFORMATION

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

In Microsoft Excel version 5.0, status bar text is assigned to macros

from the Macro Options dialog box. To select this dialog box, choose

Macro from the Tools menu, and then choose Options.

When a macro is assigned to a toolbar button, the Status Bar text

assigned to the macro is also assigned to the toolbar button and will

be saved with the document containing the macro.

If the Status Bar text is not saved (that is, if changes to the document

are not saved), the toolbar button will still retain the text

assignment until that macro is assigned to an additional button. At

that time, the original toolbar button's status bar text will revert

to the text default value.

Steps to Reproduce Behavior

---------------------------

 1. Create a new workbook and insert a module sheet into it, making the

    module sheet active.

 2. Enter the following in the new module sheet:

       Sub MyTest()

       End Sub

 3. Save the workbook.

 4. From the Tools menu, choose Macro.

 5. Select "MyTest" from the list and then choose the Options button.

 6. Enter "This Is A Test" into the Status Bar Text box and choose the OK

    button. Then, choose the Close button.

 7. From the View menu, choose Toolbars, then select the Customize button.

 8. Select Custom from the Categories list. Then, drag the yellow

    "smiley face" button onto the standard toolbar.

 9. When the Assign Macro dialog box appears, select MyTest from the

    list, and then choose the OK button.

10. Close the workbook, but DO NOT save the changes.

11. Position the mouse cursor over the yellow smiley face toolbar button

    (the Status Bar text should read "This Is A Test").

12. Re-open the workbook.

13. Repeat steps 7 through 9 above, substituting the green "frown face"

    toolbar button for the yellow "smiley face" button you used in step 8.

14. Position the mouse cursor over either new toolbar button. The Status

    Bar text for both buttons will read "Creates a button to which you can

    assign a macro."

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, Chapter 12

For more information about toolbar buttons, choose the Search button in

Help and type:

    toolbar buttons

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL5 Docerr: Shell Function Pathname and Windowstyle Parts

Article ID: Q111282

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, Visual Basic Help contains incorrect information

about the pathname and windowstyle parts of the Shell function.

Pathname

--------

In the description of the pathname part, Help states that "[the shell

function] may also be the name of a document that has been associated with

an executable program."

This information is incorrect.

You will receive an error message (even if the documents exist and are

properly associated with applications) if you use the commands:

   Shell ("c:\excel\network.txt")

   -and-

   Shell ("c:\winword\sample.doc")

The shell function cannot launch another program if the name of a file

associated with that program is passed to the shell function. If the

pathname argument is the name of a document, not the name of an

application, you will receive the error message

   Run-time error '5':

   Invalid procedure call

To work around this situation, include the name of the application.

as in the following examples:

   Shell ("notepad.exe c:\excel\network.txt")

   -or-

   Shell ("c:\winword\winword.exe c:\winword\sample.doc")

Windowstyle

-----------

The text implies that the windowstyle argument can be used to determine the

window size and focus status of the launched application. This information

is only partially correct: if windowstyle is included, you must enter a

variable name and equal sign to the left of the Shell command in order for

the command to be accepted.

The Shell statement cannot stand alone when the argument is used.

For example, this command will work

   RetVal = Shell ("c:\windows\calc.exe", 2)

but this command will not:

   Shell ("c:\windows\calc.exe", 2)

If you attempt to enter this second line, you will receive the error

message "Expected: )" and the comma in the command will be highlighted.

MORE INFORMATION

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

To find the Shell Function in Help, choose the Search button in Visual

Basic Help and type:

    Shell

KBCategory: kbdocerr

KBSubcategory:

Additional reference words: 7.00 5.00


XL: CreateObject Function Starts Invisible Instance of Excel

Article ID: Q111311

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Visual Basic for Windows, version 3.0

--------------------------------------------------------------------

SYMPTOMS

========

When you use the CreateObject function in a Visual Basic version 3.0

procedure to create a Microsoft Excel OLE Automation object, a new

instance of Microsoft Excel starts, but you cannot see it.

For example, the following Visual Basic command starts a new instance

of Microsoft Excel, but you cannot see it, and it does not appear in

the Task List:

   Set x = CreateObject("Excel.Application")

WORKAROUND

==========

If you want to see Microsoft Excel when you use the CreateObject

function to access the application object, use the Visible property

as in the following example:

   Sub Run_Excel

      Dim x As Object

      Set x = CreateObject("Excel.Application")

      x.Visible = true

   End Sub

MORE INFORMATION

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

When you use the CreateObject function to run Microsoft Excel, you

start a new hidden instance of Microsoft Excel. Because this new

instance uses memory and resources on your system, you should exit

the program within the same procedure that runs the instance. If you

don't exit the program in the procedure, the invisible instance runs

until you exit Microsoft Windows.

To free the memory used by the object variable assigned to the OLE

Automation object, set the variable equal to Nothing. The following

Visual Basic procedure uses the CreateObject function to start an

invisible instance of Microsoft Excel, quits the instance, and sets

the OLE Automation object variable equal to Nothing.

   Sub Run_Excel

      ' Dimension variable x as Object type

      Dim x As Object

      ' Set x equal to Excel object

      Set x = CreateObject("Excel.Application")

      ' Make running instance of Excel visible

      x.Visible = true

      ' Insert desired Excel commands here

      ' Quit Microsoft Excel

      x.Quit

      ' Set x equal to nothing to free memory object was using

      Set x = Nothing

   End Sub

CreateObject Versus GetObject Functions

---------------------------------------

CreateObject and GetObject are two Visual Basic functions that you

can use to return an OLE Automation object. The CreateObject function

creates an OLE Automation object; the GetObject function retrieves an

OLE Automation object from a file. The way an application behaves

when you start it with one of these functions depends on the

application. For example, when you use the CreateObject function to

access a Microsoft Excel Application object, an invisible instance of

Microsoft Excel runs. When you use the CreateObject function to

access a Microsoft Word WordBasic object, a visible instance of

Microsoft Word runs.

Use the following list to determine the behavior of Microsoft Excel

when you use the CreateObject or GetObject function:

Function                              Behavior

---------------------------------------------------------------------------

CreateObject("Excel.Application")     Always loads a new invisible instance

GetObject("", "Excel.Application")    Always loads a new visible instance

GetObject(, "Excel.Application")      Either returns an already running

                                      instance, or fails with error message

                                      "OLE Automation server cannot create

                                      object"

Microsoft Word for Windows

--------------------------

When you use the CreateObject function to access a Microsoft Word for

Windows WordBasic object, a new visible instance runs if Word for

Windows is not currently running. If you set the variable returned by

the CreateObject function equal to nothing in this case, Word for

Windows is closed. Otherwise, if Word for Windows is already running,

the CreateObject function uses the running instance. If you set the

variable returned by the CreateObject function equal to nothing in

this case, Word for Windows is not closed, because the instance was

running before you ran the procedure.

The following Visual Basic procedure uses the CreateObject function

to access the Word for Windows WordBasic object, performs some Word

commands, and then sets the OLE Automation object variable equal to

Nothing.

   Sub Run_Word ()

      ' Dimension variable word as Object type

      Dim word As Object

      ' Set word equal to Word for Windows object

      ' Start Word for Windows if not already running

      Set word = CreateObject("Word.Basic")

      ' Create new file

      word.FileNew

      ' Insert text in new file

      word.Insert "Some Text"

      ' Save file as TEXT.DOC

      word.FileSaveAs "text"

      ' Quit Word if it was not already running before this procedure ran

      ' Set word equal to nothing to free memory used for object variable

      Set word = Nothing

   End Sub

NOTE: The above information applies both to Visual Basic version 3.0,

and Visual Basic, Applications Edition. However, because Microsoft

Excel has an object library, use the functions defined in that

library when you access Microsoft Excel objects in a Visual Basic,

Applications Edition procedure, rather than the GetObject or

CreateObject function. Because Microsoft Word for Windows does not

have an object library, you must use the CreateObject or GetObject

function to access a Microsoft Word object in any version of Visual

Basic.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

For more information on the GetObject function, query on the

following words in the Microsoft Knowledge Base:

   ole and automation and getobject

REFERENCES

==========

For more information about the GetObject Function and the

CreateObject Function, choose the Search button in the Visual Basic

Reference and type:

    OLE Automation

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00 officeinterop Word6 B_VBasic


XL: Some Special Characters Are Changed in Imported Files

Article ID: Q111397

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the data source character set for various file types is

not available in the Open dialog box (from the File menu, choose Open).

MORE INFORMATION

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

You cannot specify the character set when you open a file into Microsoft

Excel. For instance, dBASE files will always be imported using the ASCII

character set, and FoxPro for Windows will generate ANSI-DBF files. As a

result of this automatic character formatting, some special characters may

be lost or displayed incorrectly. For example, international characters,

such as French and German accent marks, may be converted to their

corresponding characters in default character set.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00 dBASE dif dbf import


XL: XL5GALRY.XLS Opened As Hidden Workbook

Article ID: Q111491

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the file XL5GALRY.XLS is opened as a hidden

workbook when you do any of the following:

 - Create a chart with a user-defined chart set as the Default Chart Format

 - Apply a user-defined chart autoformat using the AutoFormat command

   located on the Format menu

 - Choose Options from the Tools menu

Note that when you perform one of the above actions for the first time, it

takes longer than when you perform the action again in the same session of

Microsoft Excel. This additional time is the time it takes Microsoft Excel

to open the file XL5GALRY.XLS. You cannot unhide this file when it is open.

MORE INFORMATION

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

When you perform one of the above actions, the XL5GALRY.XLS file is opened

as a hidden file, and remains in your computer's memory until you do any of

the following:

 - Quit Microsoft Excel

 - Close all files by holding down the SHIFT key and choosing Close All

   from the File menu.

 - Open the file XL5GALRY.XLS. (This action is not recommended.)

The file XL5GALRY.XLS is used to store custom chart autoformats. This

file is in the Microsoft Excel version 5.0 file format (with slight

modifications so that it can be accessed as a hidden workbook). To

modify this file, use one of the methods below.

CAUTION: You should not have to open this file to modify it. If you do open

XL5GALRY.XLS, you should create a backup before making any changes to the

file.

Using the AutoFormat Command

----------------------------

Add a custom chart format to XL5GALRY.XLS or delete a custom chart

format from XL5GALRY.XLS by doing the following:

1. Open or create a chart that contains the formatting you want to add as a

   custom chart format.

2. From the Format menu, choose AutoFormat. Under Formats Used, select the

   User-Defined option, and choose Customize.

   To add a custom chart format:

   a. Choose Add.

   b. In the Format Name box, type the name for your custom autoformat. In

      the Description box, type a description for your custom autoformat.

      Choose OK. Choose Close.

   To delete a custom chart format:

   a. From the Formats list, select the autoformat you want to remove.

   b. Choose Delete. Choose Yes to delete the user-defined format. Choose

      Close.

Using Chart Tab in Options Dialog Box

-------------------------------------

Add a custom chart format to XL5GALRY.XLS by doing the following:

1. Open or create a chart that contains the formatting you want to add as a

   custom chart format.

2. From the Tools menu, choose Options, and select the Chart tab.

3. Choose the Use The Current Chart button. In the Format Name box, type

   the name for your custom autoformat and choose OK.

The new chart autoformat you created is added to the Default Chart

Format list and is selected as the default. If you don't want this

format to be applied to all new charts, select another autoformat

from the Default Chart Format list. Choose OK.

REFERENCES

==========

For an Overview Of Working With Chart Autoformats, choose the Search

button in Help and type:

    chart autoformats

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: System Hangs with Circular Workbook Links

Article ID: Q111492

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In a Microsoft Excel workbook, if you insert a link to another

Microsoft Excel workbook, when that workbook itself contains a link to the

first workbook, your computer responds very slowly and may hang.

MORE INFORMATION

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

In applications that support Object Linking and Embedding (OLE)

version 2.0, you can insert the contents of a file into your document

and link to the file so that changes to the source file are reflected

in your document. However, if you use this functionality in Microsoft

Excel to link to a workbook, and you create a circular reference in

the process, you do not receive an error message, but your system

will respond very slowly and may hang.

A circular reference occurs when you reference an object, and that

object contains a reference to the original object such that each

reference refers to itself. Avoid creating circular references when

linking a Microsoft Excel workbook to another workbook.

To insert the contents of a file into a workbook and link to the

file, do the following:

1. In Microsoft Excel, choose Object from the Insert menu.

2. Select the Create From File tab. From the File Name list, select the

   file you want to link to. Select the Link To File check box and choose

   OK.

REFERENCES

==========

For an Overview Of Linking And Embedding, choose the Search button in

Help and type:

    OLE, described

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00 hang locked crash


XL: Determining Which Items Are Selected in a List Box

Article ID: Q111564

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can determine which items in a multi-selection list

box are selected by using the Selected property of the list box. This

article contains an example of how this can be done with a Visual Basic

procedure.

MORE INFORMATION

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

In a custom dialog box, a multi-selection list box allows you to choose any

number of items from a list. For example, if a list contains Alpha, Bravo,

and Charlie, you can select any, none, or all of those items.

To determine which items are selected, you can use the Selected property of

the list box. The Selected property of a multi-selection list box is an

array of values: each value is either True, if the item is selected, or

False, if the item is not selected. For example, if the list contains 1, 2,

3, and 4, and 2 and 3 are selected, the Selected property would be the

following array

   False, True, True, False

because the first item (1) is not selected, the second and third items (2

and 3) are selected, and the fourth item (4) is not selected.

An example of how to read the Selected array in a Visual Basic procedure is

shown below.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic for applications procedures for

illustration only, without warranty either expressed or implied, including

but not limited to the implied warranties of merchantability and/or fitness

for a particular purpose. This Visual Basic procedure is provided 'as is'

and Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

1. In a new workbook, insert a new worksheet (Sheet1), a dialog sheet

   (Dialog1), and a Visual Basic module (Module1).

2. On the worksheet, enter the following values:

      A1: Alpha

      A2: Bravo

      A3: Charlie

      A4: Delta

      A5: Echo

      A6: Foxtrot

      A7: Golf

      A8: Hotel

3. On the dialog sheet, add an OK button that is set to dismiss the dialog

   box.

4. On the dialog sheet, do the following to add a multi selection list box

   ("List1") that is linked to Sheet1!$A$1:$A$8.

   a. On the Forms toolbar, choose the List Box button. Drag on the dialog

      frame to create a list box.

   b. Select the list box.

   c. In the Name box, type "List1" (without the quotation marks) and press

      the ENTER key.

   d. From the Format menu, choose Object.

   e. Select the Control tab.

   f. In the Input Range box, type "Sheet1!$A$1:$A$8" (without the

      quotation marks).

   g. Under Selection Type, select the Multi option.

   h. Choose OK to accept the change.

   The list box is now linked to Sheet1!$A$1:$A$8 and is a multi selection

   list box.

5. In Module1, enter the following:

   '----------------------------------------------------------------------

   Sub ShowSelectedItems()

      ' Dimension variables

      Dim CurList As ListBox, Chosen As Integer

      Dim LTemp As Variant, LItem As Variant

      Dim Counter As Integer, MsgBoxText As String

      ' Set an object name for the list box to make it

      ' easier to reference

      Set CurList = _

        DialogSheets("Dialog1").ListBoxes("List1")

      ' Initialize the list so that none of the items are

      ' selected

      CurList.Selected = _

        Array(False, False, False, False, False, False, False, False)

      ' Show the dialog box and set variable 'chosen' to

      ' the value returned by the dialog box

      chosen = DialogSheets("Dialog1").Show

      ' If cancel is chosen, exit the procedure

      If chosen = 0 Then GoTo canceled

      ' Set the variable LTemp equal to the array of values

      ' indicating the selection state of the list box items

      LTemp = CurList.Selected

      ' Initialize the Counter variable.

      Counter = 1

      ' Iterate through the loop once for each item in the

      ' array (which is the same as iterating once for each

      ' item in the list box).

      For Each LItem In LTemp

      ' If the value of the current item is True...

      If LItem = True Then

         ' Add text to the MsgBoxText variable indicating

         ' that the item is selected

         ' CurList.List(Counter) returns the text of the selected item

         ' ("Alpha", "Bravo", and so on).

         MsgBoxText = MsgBoxText & CurList.List(Counter) & _

           " is selected. " & Chr(13)

      ' Otherwise...

      Else

         ' Add text to the MsgBoxText variable indicating that

         ' the item is not selected

         ' CurList.List(Counter) returns the text of the unselected item

         ' ("Alpha", "Bravo", and so on).

         MsgBoxText = MsgBoxText & CurList.List(Counter) & _

           " is NOT selected. " & Chr(13)

      End If

      ' Increment the Counter so we can get the value of the

      ' next selected item.

      Counter = Counter + 1

      ' Repeat until all the items in the list have

      ' been checked

      Next

      ' Display a dialog box indicating the selection state

      ' of each item in the list

      MsgBox MsgBoxText

   ' If the Cancel button was chosen, exit procedure

   canceled:

   End Sub

   '----------------------------------------------------------------------

6. To run the subroutine, position the insertion point anywhere in the

   procedure, and either press F5 or choose Start from the Run menu.

7. When the dialog box is displayed, select one or more items in the list

   box, and choose the OK button.

A dialog box is displayed that indicates for each item in the list whether

it was selected or not.

Note that you can modify this example and substitute any functions that

perform a desired task using the selection state of the list items. For

example, you might want to insert the current list item into a cell on a

worksheet. To do this, you could use the following command

   Sheets("Sheet1").Cells(10, 10).Value = CurList.List(Counter)

to put the current list item into cell J10 on Sheet1.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c howto multiple dropdown


XL5 Err Msg: "Not Enough Stack Space to Run Macro"

Article ID: Q111867

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you choose a control in a dialog box that is

assigned to an event macro when there are a total of three dialog

boxes on the screen that have not been dismissed, you may receive the

following error message(s):

   Not Enough Stack Space to Run Macro

   -or-

   Error 28: Out of Stack Space

   -or-

   Run-time error '28':

   Out of stack space

WORKAROUND

==========

To avoid receiving either of these error messages when you call nested

dialog boxes, do not assign a dialog control (such as a button or a check

box) to a macro event that calls another dialog box. Instead, assign the

control to first dismiss the active dialog box, then call the desired

dialog box from the same the macro that called the first dialog box. To

dismiss the active dialog box, do any of the following:

 - Format the control with the Dismiss property:

   1. Select the control and choose Object from Format menu.

   2. In the Format Object dialog box, select the Dismiss check box on the

      Control tab.

   -or-

 - Assign the control to a macro that contains the following command:

      ActiveDialog.Hide

   -or-

 - Format the control with the Cancel property:

   1. Select the control and choose Object from Format menu.

   2. In the Format Object dialog box, Select the Cancel check box on the

      Control tab.

 - For an additional workaround, please see the following article(s) in the

   Microsoft Knowledge Base:

      ARTICLE-ID: Q125805

      TITLE     : XL: Displaying Several Dialog Boxes Without Looping

MORE INFORMATION

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

A dialog box is not updated until after the event macro has finished. The

event macro is the code that is run when an action, such as choosing a

button, is taken in the dialog box. Because the dialog box is not updated,

if you call a dialog from another dialog, the first dialog is still loaded

(stacked) and is not released until the code that it ran (calling the

second dialog) has completed. This condition exists even if the property of

the button that called the second dialog is set to dismiss.

In Microsoft Excel 5.0, you can stack dialog boxes (that is, display more

than one dialog box on the screen at one time) with the top dialog

box active. You can stack two dialog boxes, and still run code

assigned to controls on the second dialog box. For example, you can

call Dialog Two from Dialog One, and then run a macro assigned to a

control on Dialog Two by choosing the control. In addition, you can

call Dialog Three from Dialog Two, but you cannot run any event

macros from this top level (Dialog Three) dialog box.

Note that you cannot hide a dialog box until the macro that hides the

dialog box ends.

Visual Basic Example

--------------------

In the following example, there are three dialog boxes. Each dialog

box can call either of the other two dialog boxes. Each button is

assigned to a macro that sets the value of a variable. The value of

the variable determines which dialog box to display next.

1. Create three dialog sheets. Modify each dialog sheet to contain the

   following:

      Dialog Sheet

      Buttons        Dialog1  Dialog2  Dialog3

      ----------------------------------------

      OK               yes      yes      yes

      Cancel           yes      yes      yes

      Go_To_Dialog1    no       yes      yes

      Go_To_Dialog2    yes      no       yes

      Go_To_Dialog3    yes      yes      no

2. Set the dismiss property for each button by doing the following:

   a. Select the button on the dialog sheet.

   b. From the Format menu, choose Object. Select the Control tab, and

      select the Dismiss check box. Choose OK.

3. In a new module in the same workbook, type the following:

   ' Define the variable as Integer type

   Dim dialog_number As Integer

   Sub Main()

      dialog_number = 1                  'initialize the variable

      DialogSheets("Dialog1").Show       'display the first dialog sheet

      While dialog_number > 0            'while variable is greater than 0

         Select Case dialog_number       'display a dialog based on the

                                         'value of dialog_number

            Case 1

                                              'dialog_number is 1

               DialogSheets("Dialog1").Show   'display dialog1

            Case 2

                                              'dialog_number is 2

               DialogSheets("Dialog2").Show   'display dialog2

            Case 3

                                              'dialog_number is 3

               DialogSheets("Dialog3").Show   'display dialog3

         End Select

      Wend

   End Sub

'The following code sets the value of the dialog_number variable

Sub Go_To_Dialog1()

    dialog_number = 1

End Sub

Sub Go_To_Dialog2()

    dialog_number = 2

End Sub

Sub Go_To_Dialog3()

    dialog_number = 3

End Sub

Sub OK_Or_Cancel()

    dialog_number = 0

End Sub

4. Select the Dialog1 sheet tab. Select the Go_To_Dialog2 button, and

   choose Assign Macro from the Tools menu. From the Macro Name/Reference

   list, select Go_To_Dialog2() and choose OK.

5. Repeat step 4 for each button, assigning the corresponding macro to each

   button on each dialog sheet. Assign the OK_Or_Cancel macro to each OK

   and Cancel button.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, page 219-239

KBCategory: kbcode kbmacro

KBSubcategory:

Additional reference words: 7.00 5.00 5.0 overflow


XL5: List in Dialog Box Does Not Reflect Changes Made by Macro

Article ID: Q111900

----------------------------------------------------------------------

The information in this article applies to:

- Microsoft Excel for Windows, versions 5.0, 5.0c

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use a Visual Basic macro to clear (deselect)

an item in a list box, if the list box has a selection type of Multi or

Extend, the item may appear to remain selected.

Note that Microsoft Excel DOES recognize that the item is no longer

selected; this problem has to do with the way that the dialog box is

displayed.

CAUSE

=====

If you use a Visual Basic macro to clear an item in a list box while the

dialog box that contains that list box is active, the screen may not be

properly redrawn (to show that the item is no longer selected).

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows 95, version 7.0.

MORE INFORMATION

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

In custom dialog boxes, if a list box has the Selection option set to

Multi, you can choose any number of items from the list. For example, if a

list contains Alpha, Bravo, and Charlie, you can select any, none, or all

of those items.

You can use a Visual Basic macro to select and clear items in a multiple

selection list box by changing the Selected property of a single list item.

For example, if the active dialog box contains a list box (for example,

List1) that contains three items (for example, Alpha, Bravo, Charlie), you

can select the first item by using this line of code:

   ActiveDialog.ListBoxes("List1").Selected(1) = True

To clear (deselect) the third item, use this code:

   ActiveDialog.ListBoxes("List1").Selected(3) = False

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

The following example assumes you have a workbook that contains a

worksheet (Sheet1), a dialog sheet (Dialog1), and a Visual Basic

module (Module1). The worksheet contains the following values:

   A1: Alpha

   A2: Bravo

   A3: Charlie

   A4: Delta

The dialog sheet contains an OK button that is set to dismiss the

dialog box, another button (Button1), and a Multi Selection list box

(List1) that is linked to Sheet1!$A$1:$A$4.

To create Button1:

1. On the Forms toolbar, choose Create Button to create a

   button in your dialog sheet.

2. Select the button.

3. In the name box, type "Button1" (without the quotation marks) and press

   the ENTER key.

4. From the Tools menu, choose Assign Macro.

5. In the Assign Macro dialog box, select the ClearItem subroutine

   (shown below) and choose OK.

To create a Multi Selection list box and the necessary link:

1. Use the List Box button to create a list box in your dialog sheet.

2. Select the list box.

3. In the name box, type "List1" (without the quotation marks) and press

   ENTER.

4. From the Format menu, choose Object.

5. Select the Control tab.

6. In the Input Range box, type "Sheet1!$A$1:$A$4" (without the

   quotation marks).

7. Under Selection Type, select Multi.

8. Choose OK to accept the change.

The list box is now linked to Sheet1!$A$1:$A$4 and is a multiple selection

list box.

In Module1, enter the following subroutine:

'------------------------------------------------------------------

Option Explicit

Sub ShowDialog()

   'Dimension some variables.

   Dim CurList As Variant, LTemp As Variant, LItem As Variant

   Dim Counter As Integer

   'Show the dialog box.

   DialogSheets("Dialog1").Show

   'Set an object name for easy referencing of the list box.

   Set CurList = DialogSheets("Dialog1").ListBoxes("List1")

   'Put the Selected array into the variable LTemp.

   LTemp = CurList.Selected

   'Initialize the Counter variable.

   Counter = 1

   'Iterate through the loop once for each item in the array (which is

   'the same as iterating once for each item in the list box).

   For Each LItem In LTemp

      'If the value of the current item is True...

      If LItem = True Then

         '...show a message box indicating the item is selected.

         'CurList.List(Counter) gets us the value of the selected item

         '("Alpha", "Bravo", etc.).

         MsgBox CurList.List(Counter) & " is selected."

      'Otherwise...

      Else

         '...indicate that it isn't selected.

         MsgBox CurList.List(Counter) & " is NOT selected."

      End If

      'Increment the Counter so we can get the value of the next

      'selected item.

      Counter = Counter + 1

   Next                                  'repeat until all done

End Sub

Sub ClearItem()

   'Clear the second item in the list box.

   ActiveDialog.ListBoxes("List1").Selected(2) = False

End Sub

'--------------------------------------------------------------------

To test the subroutine, position the insertion point in the line that

contains Sub ShowDialog(), and either press F5 or choose Start from the Run

menu, and do the following:

1. While the dialog box is visible, select the third and second items in

   the list, in that order.

2. Choose the Button1 button. Note that items 2 and 3 both appear to be

   selected.

3. Choose the OK button.

   Note that the message boxes indicate that the second item (Bravo)

   is not selected, even though it appears to be selected in the dialog

   box.

4. Run the ShowDialog subroutine again to redisplay the dialog box.

5. Clear the third item in the list. Then, select the fourth and

   second items, in that order. Then, clear the fourth item.

   At this point, only the second item should appear to be selected.

6. Choose the Button1 button.

   The second item will appear to be cleared, and the fourth item will

   appear to be selected.

7. Choose the OK button.

You will receive message boxes indicating that all items are not

selected, even though the fourth item appears to be selected.

In each case, the message boxes show the true status of each item: the way

the list appears in the dialog box does not accurately represent the status

of the items in the list.

KBCategory: kbprb

KBSubcategory:

Additional reference words: 5.00


XL: Print Reports Not Using Continuous Page Numbers

Article ID: Q112101

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you print a report (from the File menu, choose

Print Report), the pages in your report are not numbered consecutively.

CAUSE

=====

The pages of your report may not be numbered consecutively if the First

Page Number setting in the Page Setup dialog box was set to Auto, instead

of 1, when the first view in the report was added.

The Print Report command uses the first view in the report to determine the

initial page number: when this number is Auto, the Print Report add-in does

not acknowledge the Use Continuous Page Numbers setting in the Add Report

and Edit Report dialog boxes; instead, each view begins with page 1.

Example

-------

If you have a workbook that contains four worksheets, each with the

following defined views

   Worksheet   Defined Views

   -------------------------

   Sheet1      View1, ViewA

   Sheet2      View2, ViewB

   Sheet3      View3, ViewC

   Sheet4      View4, ViewD

and you want to print a report that includes the following views (in the

order shown)

   Sheet3, View3

   Sheet2, ViewB

   Sheet1, View1

   Sheet4, ViewD

and you want to use continuous page numbers, the Use Continuous Page

Numbers setting will not work correctly unless the First Page Number

setting was set to 1 at the time View3 (the first view in the

report) was added.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

WORKAROUNDS

===========

To print reports with continuous page numbers, the first view in the report

must have its First Page Number setting set to 1. To change this setting

for your reports, do either of the following:

 - Change the First Page Number setting for all sheets to 1 BEFORE you add

   any views

   -or-

 - Change the First Page Number setting for the first view in the report,

   and redefine the view

NOTE: To use either of these workarounds, the Use Continuous Page Numbers

check box (in the Edit Report or Add Report dialog box) must be selected.

To change the First Page Number

Setting for all sheets before adding views

------------------------------------------

1. From the sheet tab shortcut menu, choose Select All Sheets.

2. With all the sheets selected, choose Page Setup from the File menu, and

   select the Page tab.

3. In the First Page Number box, type "1" (without the quotation marks),

   and choose OK.

To change the First Page Number setting for the

First view in the report, and then redefine that view

-----------------------------------------------------

1. Activate the sheet that contains the first view in the report.

2. From the View menu, choose View Manager.

3. From the list of Views, choose the first view in the report and choose

   the Show button.

4. From the File menu, choose Page Setup, and select the Page tab.

5. In the First Page Number box, type "1" (without the quotation marks) and

   choose OK to accept the change.

6. From the View menu, choose View Manager. In the View Manager dialog box,

   choose the Add button.

7. In the Name box, type

      View3

   where View3 is the name of the first view in your report.

8. Under Include With View, make sure that the Print Settings check box is

   selected. Choose OK.

9. When you are prompted to "Overwrite existing view <viewname>?", choose

   OK.

When you print the report, the report should be printed using continuous

page numbers.

NOTE: If a different view is printed first, you will need to redefine that

view so that the First Page Number setting is 1, not Auto.

MORE INFORMATION

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

"User's Guide," version 5.0, pages 251, 614-616

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Printing Cell Notes As Separate Printout

Article ID: Q112221

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the Notes option is located on the Sheet tab of the

Page Setup dialog box (from the File menu, choose Page Setup). When this

option is selected, notes will be appended to the printed worksheets.

You do not have the option of automatically printing notes separately

(without printing the worksheet data).

This feature is by design.

WORKAROUND

==========

To print notes separately from the worksheet:

1. From the File menu, choose Print Preview.

2. Scroll to the page that contains the notes.

3. To print only the page that contains the notes, choose the Print button,

   and specify to print Pages <n> to <n> (where n is the page or pages

   containing the notes).

REFERENCES

==========

"Userÿs Guide," version 5.0, page 676

For more information about Notes, choose the Search button in

Help and type:

    Notes

KBCategory: kbusage

KBSubcategory:

Additional reference words: Notes 5.00


XL: 'For Each Item in List' Doesn't Work

Article ID: Q112330

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the Visual Basic 'For Each...Next' control structure

may not function properly if the group argument is a list in a custom

dialog box.

MORE INFORMATION

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

In Microsoft Excel, you can use the 'For Each...Next' control structure to

repeat a group of statements for each element in an array or collection.

For example, the following code displays dialog boxes containing the

contents of each cell in a selected range:

   For Each mCell In Selection  '"Selection" is the group argument

      MsgBox mCell.Value

   Next

If the group argument is a list in a custom dialog box, the For Each

command may fail, and you will receive the following error message:

   Run-time error '10':

   Duplicate definition

WORKAROUND

==========

To avoid this error, set an object equal to the list

   <Object> = <Listname>.List

and then use the object in the For Each statement. For example, instead of

   xList = DialogSheets("Dialog1").ListBoxes("List1")

   For Each mItem in xList.List

      <statements>

   Next

use

   xList = DialogSheets("Dialog1").ListBoxes("List1")

   mTemp = xList.List

   For Each mItem in mTemp

      <statements>

   Next

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

This example shows one way that you can avoid the error associated with

calling a list directly from a For Each statement.

The following example assumes you have a workbook that contains a

Visual Basic module (Module1) and a dialog sheet (Dialog1). The

dialog sheet contains a single list box (List1).

In Module1, enter the following subroutine:

'----------------------------------------------------------------------

Option Explicit

Sub ForEachListItem()

   'Dimension some variables.

   Dim Alpha As Variant, Foxtrot As Variant, Golf As Variant

   'Set an object name for easy referencing of the list box.

   Set Alpha = DialogSheets("Dialog1").ListBoxes("List1")

   'Add three items to the list.

   Alpha.AddItem "Bravo"

   Alpha.AddItem "Charlie"

   Alpha.AddItem "Delta"

   'Set an object name so that the For Each structure can function

   'properly.

   Golf = Alpha.List

   'Iterate through the loop once for each item in Golf (which is

   'the same as iterating once for each item in the list box).

   For Each Foxtrot In Golf

      'Show the current list item in a message box.

      MsgBox Foxtrot

   Next                                  'repeat until all done

End Sub

'----------------------------------------------------------------------

To run the subroutine, position the cursor in the line that reads

"Sub ForEachListItem()," and either press F5 or choose Start from the Run

menu.

If the For Each line is entered as shown, the subroutine will run

properly and message boxes will display the names of the items in the

list.

If the For Each line is altered to refer to Alpha.List directly,

without using an intermediary function (in this case, Golf), you will

receive the error message shown above and the message boxes will not

be displayed.

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00


Excel: Negative Date/Time Value Displayed as Pound Signs (#)

Article ID: Q112361

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

If Microsoft Excel is set to use the 1900 date system, and you add or

subtract data that is formatted with a time format, the date may not be

displayed as you expect. When the results of the formula produce a negative

value, and this data is formatted to display a time value, the cell

displays pound signs "###".

CAUSE

=====

Although the formula in the cell performs the correct operation, the number

format returns the wrong results.

WORKAROUND

==========

To display the number correctly, do either of the following:

 - Change the date system to the 1904 Date System.

   -or-

 - Use the following to change the displayed result

      =TEXT(ABS(A1-A2),"-h:mm:ss")

   where A1 has a value smaller than A2.

The above formula will display the value as text. You may need to format

the cell alignment to right justified. This is not an acceptable workaround

if you need to use the result in another calculation.

STATUS

======

Microsoft is researching this problem and will post new information here as

it becomes available.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.10c 2.10d 3.004.00 4.00a

5.00 2.2 2.1


XL: Fonts Too Big After Print or Print Preview

Article ID: Q112456

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you scroll through a zoomed document after you

print a file or view it in print preview, the characters that are off of

the screen may appear much larger than the indicated size.

CAUSE

=====

This problem may occur when you open a document that is zoomed to any size

other than 100%, and when you then immediately print the document or view

it in print preview. Characters that did not appear on the screen before

you printed it or viewed it in print preview may appear much larger than

expected if they are formatted differently than the characters that

appeared on the screen when you printed the document.

Formatting attributes that may not appear as expected include the font,

size, underlining, or color.

WORKAROUND

==========

To work around this problem, close the document and reopen it. To prevent

this behavior from occurring, scroll through the document before you print

it or before you view a it in print preview.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 large


XL5: Message Always Sent from cc:Mail as "Low Priority"

Article ID: Q112507

-------------------------------------------------------------------

The information in this article applies to:

- Microsoft Excel for Windows, version 5.0

-------------------------------------------------------------------

SYMPTOMS

========

When you use Lotus Development Corporation's cc:Mail to send a mail message

containing a workbook from Microsoft Excel version 5.0 for Windows, all of

your mail messages are sent with a low priority setting.

CAUSE

=====

This prioritization problem is caused by a problem contained in the version

of the MAPIVIM.DLL file that is shipped with Microsoft Excel version 5.0.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

later versions of Microsoft Excel for Windows.

WORKAROUND

==========

To work around this problem, you must use a MAPIVIM.DLL file version

1.0.0.63 or later.

This version of the file is included with the following applications:

 - Microsoft Word for Windows version 6.0a

 - Microsoft PowerPoint version 4.0

 - Microsoft Office version 4.2

 - International versions of Microsoft Excel version 5.0

If you do not have one of the above applications, you can obtain an

appropriate version of this file by accessing the application note

WE1009 "MAPI-to-VIM Translation .DLL MAPIVIM.DLL Version 1.0.0.63." For

more information about accessing this Application Note, query on the

following words in the Microsoft Knowledge Base:

  AppNote and WE1009 and translation

MORE INFORMATION

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

The MAPIVIM.DLL file allows Microsoft applications, such as Microsoft

Excel and Microsoft Word for Windows, to insert documents into mail

messages and then send those messages using the cc:Mail program.

The MAPIVIM.DLL file that ships with Microsoft Excel version 5.0 for

Windows is version 1.0.0.53, dated 12/14/93. This version of MAPIVIM.DLL

contains a problem that causes all messages to be sent with a low priority

setting, even if you choose to send the message at a higher priority

setting.

If you have Microsoft Windows for Workgroups 3.11 installed on your

computer, do the following to check the version of MAPIVIM.DLL that is

installed on your system:

1. In Microsoft Windows File Manager, switch to the WINDOWS\SYSTEM

   directory.

2. In the File list, select the MAPIVIM.DLL file.

3. From the File menu, choose Properties.

4. In the "Properties for MAPIVIM.DLL" dialog box, you should see

   a line that reads

      Version: 1.0.0.xx

   where xx is a number.

If the version is earlier than 1.0.0.63, or if the date of the file

is earlier than 1/14/94, you will probably want to obtain a later

version of the MAPIVIM.DLL file.

KBCategory: kbappnote

KBSubcategory:

Additional reference words: 5.00 e-mail email mapi officeinterop


XL: Pie Chart Shows Incorrect Percentage Value

Article ID: Q112773

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Graph for Windows, version 5.0

 - Microsoft Graph for the Macintosh, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel or Microsoft Graph, when you display percentages in a

pie chart (the pie chart type 6 in the AutoFormat dialog box), an incorrect

percentage may be displayed for the largest number in the series.

CAUSE

=====

Because of the way Microsoft Excel and Microsoft Graph round numbers, the

percentages will often add up to be 101% instead of 100%. When this

happens, Microsoft Excel and Microsoft Graph subtract 1% from the largest

number in order to force the total percentage to equal 100%.

WORKAROUND

==========

To work around this problem, use the following appropriate method:

Microsoft Excel version 7.0

---------------------------

1. Select all of the data labels, by clicking any of the individual data

   labels on the chart.

2. On the Format menu, click Selected Data Labels.

3. Click the Number tab. In the Decimal Places box, enter "2" (without the

   quotation marks) and click OK.

Microsoft Excel version 5.x

---------------------------

1. Select the largest data label by slowly clicking twice (do not double

   click rapidly). This ensures that only the largest data label is

   selected.

2. From the Format menu, choose Selected Data Labels.

3. From the Number tab, choose the Percentage Category with a 0.00% format.

   This should cause the second largest data label to correctly round up to

   become the largest label.

4. Select all data labels and reformat them as desired by choosing Selected

   Data Labels from the Format menu, and then selecting the appropriate

   number format on the Number tab.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

MORE INFORMATION

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

Incorrect percentages can also occur when you use percentages in your data

(even when your percentages equal 100.00%). When you use Microsoft Graph

version 5.0, the data in the range A1:B10 below produces an incorrect data

label. The percentage 34.2% is displayed as 33.2% when the data label is

set to "Percent" or "Label and Percent." When the data label is set to

"Value" the percentage displays correctly.

   A1: Name       B1: Sales

   A2: Ford       B2: 24.7%

   A3: GM         B3: 34.2%

   A4: VW         B4:  0.6%

   A5: Chrysler   B5: 13.3%

   A6: Toyota     B6:  8.0%

   A7: Honda      B7:  6.0%

   A8: Other      B8:  6.0%

   A9: Mazda      B9:  2.6%

  A10: Nissan    B10:  4.6%

KBCategory: kbother

KBSubcategory:

Additional reference words: 5.00 5.00a 5.00c 7.00 Graph


XL: OLE Automation, Can't Use Named Arguments in Visual Basic

Article ID: Q112813

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you use a Microsoft Visual Basic application, you cannot call a

Microsoft Excel OLE automation object using named arguments. Instead, you

must use arguments in their correct order, using commas as place holders

even for omitted arguments.

In Visual Basic in Microsoft Excel (called the Microsoft Visual Basic

Programming System, Applications Edition), names are defined for the

arguments to their properties and methods. These names allow you to list

arguments in any order or omit preceding arguments.

The following is an instruction in Visual Basic in Microsoft Excel

that pastes the entire contents of the clipboard on a worksheet in

the current selection, skipping any blank cells that were copied:

   ' Using Named arguments

   Selection.PasteSpecial Paste:=xlAll, SkipBlanks:=True

To use the same instruction in the Visual Basic Standard or

Professional Edition, use the following syntax

   ' Using arguments in correct order, commas as place holders

   xl.Selection.PasteSpecial xlall, , True

where xl is an object variable that refers to Microsoft Excel (the

complete Visual Basic Standard or Professional Edition code is

included below). The extra comma after the xlall value is a

place holder for the Operation argument.

NOTE: In Microsoft Excel, there are many symbolic constants defined

that are used for application-specific settings. These constants all

begin with the letters "xl". For example, xlall in the above example

is used to paste all the contents of the clipboard with the

Paste.Special command.

These Microsoft Excel constants are available automatically in

Microsoft Visual Basic for Microsoft Excel. For the Standard or

Professional Editions of Visual Basic, you must either add the

Microsoft Excel constants file XLCONST.BAS to your project to use the

constant by name as in the above example, or you must use the numeric

value of the constant. The Microsoft Excel constants file includes

the name of each constant along with the value of that constant.

This constants file is included with the "Built-in Constants in

Microsoft Visual Basic Programming System, Applications Edition"

(WE0993) application note.

For more information about obtaining this application note, query on

the following words in the Microsoft Knowledge Base:

   xlconst.bas and application and note

To see a list of the Microsoft Excel constants, do the following:

1. Insert or select a module sheet.

2. From the View menu, choose Object Browser.

3. From the Libraries/Workbooks list, select Excel.

4. From the Objects/Modules list, select Constants.

The Methods/Properties list contains the Microsoft Excel constants.

MORE INFORMATION

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

The syntax for the PasteSpecial method in Visual Basic in Microsoft

Excel is the following

   object.PasteSpecial(Paste, Operation, SkipBlanks, Transpose)

where the named arguments are included in the parentheses.

In Visual Basic Standard or Professional Edition, if you want to

leave out an argument such as operation in the example above, you

must indicate the missing argument with a comma. Trailing commas at

the end of an instruction can be omitted. In the example above, it is

not necessary to add additional commas after the final argument

(SkipBlanks).

The following procedure in Visual Basic Standard or Professional

Edition opens the workbook TEST.XLS, selects the range A1:B6, copies

the cells to the clipboard, selects a new range, and pastes the entire

copied range (except for any blank cells) to this location.

   Sub Form_Load ()

      ' Dimension variable xl as object type

      Dim xl As object

      ' Activate Microsoft Excel and assign to variable xl

      Set xl = GetObject(, "Excel.Application.5")

      ' Open workbook TEST.XLS

      xl.Workbooks.Open "c:\excel\test.xls"

      ' Select range A1:B6 on active worksheet

      xl.Activesheet.Range("A1:B6").Select

      ' Copy selection to clipboard

      xl.Selection.Copy

      ' Select cell A11

      xl.Activesheet.Range("A11").Select

      ' Paste contents of clipboard to active cell

      ' Skip blank cells in copy range

      xl.Selection.PasteSpecial xlall, , True

      Set xl = Nothing

   End Sub

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: Can't Print Collated Copies

Article ID: Q112821

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel 5.0, when you print multiple copies of a document, you

cannot automatically collate the pages unless the printer driver supports

collation.

NOTE: In earlier versions of Microsoft Excel, a document can be collated

when you print it (regardless of whether the printer driver supports

collated printing).

This functionality was added in Microsoft Excel 7.0.

STATUS

======

This method of printing is by design to allow for faster printing.

WORKAROUNDS

===========

In Microsoft Excel 5.0, to print collated copies of a file, do any of the

following:

 - Print the document to a file on your hard drive and copy the file

   to the printer multiple times from the MS-DOS prompt.

   -or-

 - Write a macro to print the selected file multiple times. Note that

   this option will be very time consuming because Microsoft Excel has

   to print single copies of the file multiple times. It is much

   faster to print a file multiple times. (Sample code is provided below.

   -or-

 - If your printer driver provides the option to print collated copies,

   use this option. You can set this option by choosing the Print command

   on the File menu and then choosing Printer Setup in Microsoft Excel

   to access the printer driver settings.

MORE INFORMATION

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

An example of collated printing is when you print two copies of a file such

that page 1 and page 2 of the first copy are printed, and then page 1 and

page 2 of the second copy are printed. In contrast, uncollated printing

would print page 1, and then another page 1, and then page 2, and then

another page 2.

Printer drivers that have a Copies box in the Print dialog box may support

collation. For example, most UNIDRV-based drivers support collation; some

printer drivers, such as the Hewlett-Packard (HP) DeskJet, do not.

SAMPLE VISUAL BASIC FOR APPLICATIONS CODE

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

The following Visual Basic for Applications code allows you to print

multiple copies.

'A procedure to print multiple copies

Sub Example()

   Ncopies = Application.InputBox("Please enter number off copies _

       to print: ", "Print Multiple Copies", 1, , , , , 1)

   For counter = 1 To Ncopies

      ActiveWindow.SelectedSheets.PrintOut Copies:=1

   Next

End Sub

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 multiple copies dialogue


Unexpected Results with Mixed Text and Numbers in Lookup Table

Article ID: Q113261

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.0, 4.0a, 5.0

 - Microsoft Excel for Macintosh, versions 2.x, 3.0, 4.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you create a lookup table, the lookup functions

may return the #N/A error value, or, if you are using the functions in a

Visual Basic, Applications Edition, macro, you may receive a "type

mismatch" error, even though the values in the lookup table are sorted in

ascending order and the value being looked up appears to fall within the

range of the lookup table values.

CAUSE

=====

When you look up a text value, Microsoft Excel looks only at the text

values in your table. Similarly, when you look up a numeric value,

Microsoft looks only at the numeric values.

STATUS

======

This behavior is by design.

MORE INFORMATION

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

If the first column (VLOOKUP) or row (HLOOKUP) of your lookup table

contains both text and numeric values, you can use Microsoft Excel to sort

your table in ascending order. In this case, the numeric values will appear

at the beginning of the table and the text values will appear at the end of

the table. Both text and numbers are then sorted as expected. For example,

the following values

   A1: 3

   A2: 1

   A3: c

   A4: 2

   A5: d

   A6: b

will be sorted as:

   A1: 1

   A2: 2

   A3: 3

   A4: b

   A5: c

   A6: d

However, if you attempt to use a lookup function to locate a text value

that is less than the first text value, the lookup the function returns the

#N/A error value.

It may appear that =VLOOKUP("a",A1:A6,1) should return the value 3, which

is the largest value that is less than the lookup value a. However, the

formula returns the #N/A error value instead. This behavior also occurs

with HLOOKUP(), LOOKUP(), and MATCH() with Match Type arguments of 1 or

negative one -1.

The same behavior also holds true if you attempt to look up a numeric value

that is less than the first numeric value in your lookup table.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Sample Visual Basic Macro Using VLookup

---------------------------------------

Sub test()

   MsgBox Application. _

   VLookup("a", Workbooks("book1.xls"). _

   Worksheets("sheet1").Range("hi"), 1, False)

End Sub

Note that in order to test this sample macro, you must create a range on

sheet1 in book1 similar to the sample range above, and you must give the

range the defined name "hi" (without the quotation marks).

WORKAROUNDS

===========

Method 1: If you want your lookup table to be split into separate tables

          for text and numbers (the default), you must include minimum

          values for both the text and the numeric values in your lookup

          table.

          Zero is the lowest positive integer and the blank space character

          is the lowest printable text character.

Method 2: If you want the table to behave the way it appears after it is

          sorted by Microsoft Excel, such that it returns the highest

          numeric value if a text value is looked up, then you must treat

          your table as text only. The following are two ways to do this:

           - Enter every cell in your table as text. Numeric values can be

             entered as text by typing an apostrophe before the value

             (versions of Microsoft Excel earlier than 5.0) or by

             formatting the cells as text (Microsoft Excel version 5.0).

             -or-

           - Convert the lookup table and the value you are looking up to

             text by entering your formula into an array formula. The

             following is an example that assumes the value to be looked up

             is located in cell B1:

                =VLOOKUP(TEXT(B1,"@"),TEXT(A1:A6,"@"),1)

             NOTE: The above formula must be entered as an array formula.

             To enter a formula as an array formula in Microsoft Excel for

             Windows, press CTRL+SHIFT+ENTER. In Microsoft Excel for the

             Macintosh, press COMMAND+RETURN.

REFERENCES

==========

For more information about Lookup Functions, choose the Search button

in Help and type:

   Lookup Functions

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 2.00 2.01 2.10 2.20 3.00 4.00 4.00a 5.00

VLOOKUP LOOKUP HLOOKUP MATCH mixed


Excel: GP Fault in ANALYSIS.XLL Using Regression Tool

Article ID: Q113468

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use the Regression tool, and you select the

Labels check box, you receive a general protection (GP) fault when the

summary output table is created. If you choose Ignore, you receive a GP

fault in module ANALYSIS.XLL when the chart is created.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows 95, version 7.0.

CAUSE

=====

This problem occurs when the first row of your input data contains

numeric values, and you select the Labels check box in the Regression

dialog box.

WORKAROUND

==========

To avoid receiving the GP fault when you use the Regression tool, do either

of the following:

 - Do not select the Labels check box in the Regression dialog box. When

   you clear this check box, data labels are automatically added to the

   summary output table.

   -or-

 - Enter non-numeric values in the first row of your input data before you

   select the Labels check box in the Regression dialog box.

MORE INFORMATION

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

The Regression tool is available when you load either the Analysis ToolPak

- VBA add-in (ATPVBAEN.XLA) or the Microsoft Excel version 4.0 Analysis

ToolPak add-in (ANALYSIS.XLL). When the add-in is loaded, the Data Analysis

command is added to the Tools menu.

When you use the Regression tool, the Regression dialog box is displayed

with input and output options. One of the input options is Labels. If the

first row in your input range includes report labels, you can select the

Labels check box so that these labels will be used in the summary output

table. If your input range does not contain labels, you can clear the

Labels check box, and the appropriate data labels for the summary output

table will be created automatically.

REFERENCES

==========

For more information about Regression, choose the Search button in

Help and type:

   Regression tool

KBCategory: kbtool kbprb

KBSubcategory:

Additional reference words: 5.00 gpf


XL: Visual Basic Code to Use Instead of DIRECTORIES()

Article ID: Q113491

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

This article contains sample Visual Basic code that you can use to

duplicate the behavior of the DIRECTORIES() function that was included in

the Microsoft Excel 4.0 FILEFNS.XLA add-in.

NOTE: The FILEFNS.XLA add-in is not included in Microsoft Excel 5.0.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Sample Visual Basic Code

------------------------

' The main procedure calls dir_test and passes it to the specified

' directory.

Sub main()

   'Always make sure the path ends with a backslash.

   'Calls dir_test and passes it the directory to check

   dir_test "c:\"

End Sub

' The dir_test procedure returns an array of all subdirectories contained

' in the specified directory. To do this, it creates the array dir_array;

' dir_array is declared as Static to hold its values after the macro has

' finished.

Sub dir_test(directory_text)

   'Dimensions a variable to hold the temp Directory name

   Dim temp_var As String

   'Dimensions a dynamic array to hold the Directory Array

   Static dir_array() As String

   'Turns off Error Checking

   On Error Resume Next

   'Call the DIR function and returns the first item the Directory

   temp_var = Dir(directory_text, vbDirectory)

   'Initializes the variable for building the array

   counter = 0

'Set a loop until the DIR function returns

Do Until temp_var = ""

    'Temp_var stores the individual Directory name

    temp_var = Dir()

    'Checks to see if temp_var is an empty string

    If temp_var <> "" Then

       'The following code will create an array of the directories

        If GetAttr(directory_text + temp_var) = 16 Then

            'enlarge the array to hold a new item

            ReDim Preserve dir_array(counter)

            'add directory to the array

            dir_array(counter) = temp_var

            'This line just shows the variable was added to the array

            'You can comment this line out when using this function

            MsgBox dir_array(counter)

            'Increase counter to make room for the next directory

            counter = counter + 1

       End If

    End If

Loop

End Sub

REFERENCES

==========

For more information about FILEFNS.XLA and the Visual Basic equivalents for

those functions, query on the following words in the Microsoft Knowledge

Base:

   FILEFNS.XLA and add-in and maintenance

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 Array Dir list directorybrowse

linked_directory


XL: Visual Basic Nested Case Statement Example

Article ID: Q113659

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can use nested case statements in Visual Basic to

execute one of several expressions based on a particular value or

expression evaluation similar to an IF statement.

MORE INFORMATION

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

The following example returns a text expression in the next column,

depending upon whether a particular date falls within a specific beginning

and ending date range. The active cell on the worksheet should be the upper-

left cell containing the dates.

Macro Example

-------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

Sub TestDate()

'The following nested case statement determines if a date within

'a column of dates falls within a certain range. If the beginning date

'or the ending date is within or out of the range, it displays a message

'in the next column.

  begin_date = DateValue(InputBox(prompt:="Enter the beginning date"))

  end_date = DateValue(InputBox(prompt:="Enter the ending date"))

  Do While ActiveCell <> ""

    'Checks the date of the current cell.

    Select Case ActiveCell

        Case Is >= begin_date

        'Nested Case to check for ending date of current cell.

        Select Case ActiveCell

            Case Is <= end_date

            ActiveCell.Offset(0, 2) = "Meets criteria"

            'Does this if the ending date is out of range.

            Case Is >= end_date

            ActiveCell.Offset(0, 2) = "Ending date out of range"

            End Select

    'Does this if the beginning date is out of range.

    Case Else

        ActiveCell.Offset(0, 1) = "Beginning date is out of range"

    End Select

    'Selects the next cell on the active worksheet.

    ActiveCell.Offset(1, 0).Select

    Loop

End Sub

KBCategory: kbusage kbtool kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 HOWTO nest case if


XL: Protect Method Fails When Module Is Hidden

Article ID: Q113786

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, the Visual Basic Protect method (syntax 2) or Unprotect

method may fail when you attempt to protect or unprotect a workbook if the

following conditions are true:

 - The module that contains the Protect or Unprotect command is hidden

   -and-

 - The Protect or Unprotect command is being applied to the workbook that

   it is contained in (it is trying to protect or unprotect its own

   workbook)

WORKAROUND

==========

To change the protection status of a workbook using a Visual Basic

subroutine contained in that workbook, use any of the following methods:

Method 1: Use the SendKeys statement to protect or unprotect the workbook.

          Note that this method works with Microsfot Excel for Windows (you

          cannot send keystrokes to applications running under the

          Macintosh operating system).

          The following example uses the SendKeys statement to send the

          key strokes necessary to protect the workbook. The

          OnTime command is used to resume another macro one second

          later. Note that Application.ScreenUpdating will not affect

          this procedure because the macro is exited and then the

          key strokes are executed from the keyboard buffer.

          The following code should be entered as the last piece of code in

          the module.

          ' You can skip this line if you are adding this code to the

          ' end of an existing macro

          Sub ProtectWorkbook()

          ' This will return to a macro named My_Macro after protecting

          ' the workbook. This line is not necessary if you do not need

          ' to resume after the workbook is protected

          Application.OnTime Now + TimeValue("00:00:01"), "My_Macro"

          ' Note that you can use %(tpp) instead of %(tpw) to

          ' protect only the active sheet.

          Application.SendKeys "%(tpw){ENTER}"

          ' The procedure must end before the keys will be sent

          End Sub

Method 2: Unhide the module that contains the subroutine before using the

          Protect method. Note that if you use this method, you cannot

          protect the structure of the workbook, and you cannot use the

          Unprotect method (because if the structure of the workbook is

          currently protected, you cannot hide or unhide a sheet in the

          workbook).

          To use a subroutine contained in a hidden module ("ModuleName")

          to protect the workbook (not the structure) in which it is

          contained, you could use the following code:

          ' Unhide the module that contains this subroutine.

          ThisWorkbook.Modules("ModuleName").Visible = True

          ' Protect the workbook by using the Protect method.

          ThisWorkbook.Protect Structure:=False, Windows:=True

          ' Re-hide the module that contains this subroutine.

          ThisWorkbook.Modules("ModuleName").Visible = False

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure.

STATUS

======

Microsoft has confirmed this to be a problem in the versions of Microsoft

Excel listed above. We are researching this problem, and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

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

When you use the Protect method to protect a workbook that contains the

running subroutine, if the module that contains that subroutine is hidden,

you may receive the following error message:

   Run-time error '1004':

   Protect method of Workbook class failed

REFERENCES

==========

For more information about the Protect Method or the Unprotect Method,

choose the Search button in MS Excel Visual Basic Help (Macintosh) or the

Visual Basic Reference (Windows), and type the following:

   protection: workbook structure

KBCategory: kbusage kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Visual Basic Example to Total Rows and Columns in an Array

Article ID: Q113940

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can use arrays to calculate and manipulate data in

a worksheet. You can also use Visual Basic, Applications Edition, to store

the values from a range of cells into a Visual Basic array.

The sample macro code in this article adds an additional column and row to

a rectangular region of cells that will contain totals for each row and

column in that region.

MORE INFORMATION

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

The following Visual Basic Code reads data from the current region of cells

surrounding the active cell on the active worksheet. The macro stores the

data within an array, then sums each row and column, placing the output on

the worksheet. The size of the array is determined by the number of cells

in the current region.

To run the macro:

1. Highlight a cell or range of cells within the region you want to sum,

   and choose Macro from the Tools menu.

2. Select the TotalRowsAndColumns macro, then choose Run.

NOTE: This macro does not enter any formulas into your worksheet, so if the

numbers in the range being totaled change, you must run the macro again.

Macro Example

-------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

Sub TotalRowsAndColumns()

' This macro assumes that you have selected any cell or group of

' cells within a rectangular region of cells that you would like to

' have totaled. The totals will appear in the row below and the

' column to the right of the current region.

Dim r As Integer

Dim c As Integer

Dim i As Integer

Dim j As Integer

Dim myArray As Variant

' Declaring myArray as a Variant prepares it to receive a range of

' cells. At that point it is transformed automatically into an array

' with beginning subscript myArray(1,1).

'Refer to the region surrounding the current selection

With Selection.CurrentRegion

r = .Rows.Count

c = .Columns.Count

'resize for totals row and column and place into array

myArray = .Resize(r + 1, c + 1)

' The following 10 lines of macro code (including comments)

' are what is commonly referred to

' as a Nested Loop. The variable i keeps track of the row number,

' while j keeps track of the column number. Every time j cycles

' through the available columns, i gets incremented by one and j

' starts the cycle from one to c all over again.

For i = 1 To r

   For j = 1 To c

      'total for row i

      myArray(i, c + 1) = myArray(i, c + 1) + myArray(i, j)

      'total for column j

      myArray(r + 1, j) = myArray(r + 1, j) + myArray(i, j)

      'grand total

      myArray(r + 1, c + 1) = myArray(r + 1, c + 1) + myArray(i, j)

   Next j

Next i

' Return the array, which now contains an extra row and column

' for the totals, to the worksheet.

.Resize(r + 1, c + 1) = myArray

End With

End Sub

To perform a similar operation to the one performed in this example, you

can modify the macro code. For example, to subtract, multiply, or divide

the values contained in the selected range of cells, you will need to

change the mathematical operator.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Toolbar Button Colors Appear Incorrectly

Article ID: Q114172

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

When you create custom toolbar buttons in Microsoft Excel, you may notice

that some of the colors applied to custom toolbar buttons appear

incorrectly when you do any of the following:

 - View them on another computer

   -or-

 - Switch to a different video driver on the same computer

   -or-

 - Exit and restart Microsoft Excel

CAUSE

=====

This problem may occur when you create toolbar buttons while using a video

driver that uses "color correction."

WORKAROUNDS

===========

 - If you have not yet created your toolbar buttons, or if your button

   images were not created from an outside source (such as Paintbrush),

   make sure that you are using a 16 color video driver that does not use

   color correction when you create or update the button images. The

   standard VGA video driver included with Microsoft Windows meets these

   criteria.

 - If you have already created your custom toolbar buttons using images

   stored as bitmaps (in Paintbrush, for example), you may be able to

   follow these steps to correct a button image:

   1. Copy the image from its original source.

   2. While in Customize mode, select the toolbar button whose image you

      want to replace and click it with the alternate mouse button (usually

      the right mouse button).

   3. From the shortcut menu, choose Paste Button Image.

   4. Use the alternate mouse button to click the same toolbar button

      again. From the shortcut menu, choose Edit Button Image.

   5. In the Button Editor, choose OK.

   6. Copy the image from its original source again.

   7. Use the alternate mouse button to click the toolbar button and choose

      Paste Button Image from the shortcut menu.

   The button image may now appear correctly. Note that the change may

   only be temporary: your buttons may revert to the incorrect colors

   when you exit and restart Microsoft Excel. If this occurs, use the

   first workaround, shown above.

 - Contact the manufacturer of your video driver and ask whether they

   have a newer video driver that uses the desired resolution and number

   of colors and that does not use color correction.

MORE INFORMATION

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

Some video drivers designed for Microsoft Windows, particularly video

drivers that display 256 or more colors, use a process called

"color correction" to determine which colors to use on the screen.

This process may cause colors to be displayed incorrectly in custom

toolbar buttons. This error is usually very subtle: for example, a

dark red color may change to a lighter red color.

Common color changes that are caused by a video driver using color

correction include the following:

   Old Color          Color Changes To

   ------------------------------------

   Dark Red           Light Red

   Dark Green         Light Green

   Really Dark Blue   Dark Blue

   Dark Magenta       Light Magenta

   Light Blue         Really Light Blue

Note that while these are typical changes, different video drivers

may affect colors differently.

KBCategory: kbenv

KBSubcategory:

Additional reference words: 5.00 7.00


XL: Commands You Can Use To Customize Setup /A

Article ID: Q114314

---------------------------------------------------------------

The information in this article applies to:

- Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can create a custom Setup script that allows a

network administrator to customize and/or automate a setup procedure that

is run from a server.

To do this, modify the SETUP.STF file (this file is created during the

administrative setup).

The following is a list of the values that you can use to reference

directories from the SETUP.STF file.

   Value          Meaning

   ------------------------------------------------------------

   %D             Use the destination directory of the parent.

   Null           Use the destination directory of the parent (same as %D).

   %S             Use the source directory.

   %W             Use the Windows directory.

   %M             Use the Windows System directory.

   %D\subdir      Use a subdirectory of the parent. Example: %D\WINWORD

   %S\subdir      Use a subdirectory of the source directory.

   %W\subdir      Use a subdirectory of the Windows directory.

   %M\subdir      Use a subdirectory of the Windows System directory.

   %OBJIDnumber   Use the same directory as the directory specified for

                  that OBJID number.

These values can be used for configuring any supported directory change in

the SETUP.STF.

For more information on creating custom Setup scripts see the NETWORK.TXT

file located on Disk 1 of the Microsoft Excel 5.0 disks.

KBCategory: kbsetup

KBSubcategory:

Additional reference words: 7.00 5.00 install installation


XL: Error Message: FUNCRES.XLA Is Not a Valid Add-in

Article ID: Q114388

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

When you attempt to load FUNCRES.XLA by using the add-in manager,

Microsoft Excel generates the message:

   'FUNCRES.XLA' is not a valid add-in.

CAUSE

=====

FUNCRES.XLA is a support add-in. The Analysis ToolPak automatically loads

and uses FUNCRES.XLA; therefore, it is not necessary to load this add-in

manually.

RESOLUTION

==========

You do not need to load the FUNCRES.XLA file manually. To avoid the above

error message, you can open FUNCRES.XLA by choosing Open from the File

menu.

STATUS

======

This is expected behavior of the FUNCRES.XLA add-in.

MORE INFORMATION

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

Steps to Reproduce Behavior

---------------------------

1. From the Tools menu, choose Add-Ins.

2. In the Add-ins dialog box, choose Browse.

3. In the Browse dialog box, select the LIBRARY subdirectory of Microsoft

   Excel, and then select the ANALYSIS subdirectory.

4. Select the FUNCRES.XLA file, and choose OK.

The error message "'FUNCRES.XLA' is not a valid add-in" is displayed on

your screen.

KBCategory: kberrmsg

KBSubcategory:

Additional reference words: 7.00 5.00 ATP Tool Pack Toolpack


XL: Command to Create Add-in File from Visual Basic Module

Article ID: Q114436

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed above, there is no built-in

method in Visual Basic, Applications Edition, that will perform a Make Add-

In operation. To create an add-in from a Visual Basic subroutine, you must

use the Application.ExecuteExcel4Macro method to call the VBA.MAKE.ADDIN

macro

command.

MORE INFORMATION

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

In the versions of Microsoft Excel listed above, you can create add-in

files by choosing Make Add-In from the Tools menu in a Visual Basic module

or Microsoft Excel 4.0 macro sheet. When you do this, you are prompted to

enter a filename for the add-in that you want to create.

To create an add-in file from a Visual Basic subroutine, use the following

line of code

   Application.ExecuteExcel4Macro "VBA.MAKE.ADDIN(""TEST.XLA"")"

where TEST.XLA is the name of the add-in file to be created.

Note that the following line of code will NOT create an add-in file (even

though it seems like it should perform the same function):

   ActiveWorkbook.SaveAs "TEST.XLA", xlAddIn

This line of code will save the active workbook as a Normal workbook

with the filename TEST.XLA.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

This code shows an example of the correct way create an add-in file

using a Visual Basic subroutine:

'----------------------------------------------------------------------

Sub MakeAddIn()

   'This command makes an add-in called TEST.XLA, based on the

   'active workbook.

   Application.ExecuteExcel4Macro "VBA.MAKE.ADDIN(""TEST.XLA"")"

End Sub

'----------------------------------------------------------------------

KBCategory: kbtools

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Copy of Recorded Macro Code Doesn't Work Correctly

Article ID: Q114437

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you copy and paste code in a Visual Basic

procedure that was created with the Macro Recorder, the pasted code may not

behave the way that you expect.

For example, when you record a Visual Basic procedure and you type text

into a cell or text box and you manually break the line (press ALT+ENTER in

a cell, or press CTRL+ENTER or ENTER in a Text Box), the line break

character is displayed as a "box" in the recorded procedure.

If you copy the line that contains this character to another location in

the module or to another module, the line is pasted as multiple lines,

breaking the text at the "box" character. This break causes either a syntax

error or the "Sub or function not defined" error message to appear when you

run the procedure. The error message you receive depends on where the line

break character is located in the string.

CAUSE

=====

In some cases, the Visual Basic code recorded by the Macro Recorder

contains an extended ASCII character (such as a carriage return or line

break). When you copy and paste this code to another location in a module,

the character is pasted with the normal functionality.

The nonprinting character used in Microsoft Excel to create the line break

is not supported by the text format in a Visual Basic module.

WORKAROUND

==========

To work around this behavior, edit the recorded procedure and replace the

symbol with a Chr(n) function, where "n" is the ASCII character code for

the extended character. For example, if the recorded macro appears as

follows in the module

   ActiveCell.FormulaR1C1 = "good||guy"

where || is the "box" character, edit the line as follows:

   ActiveCell.FormulaR1C1 = "good" & Chr(10) & "guy"

NOTE: The value 10 is the ASCII character code for a carriage return.

MORE INFORMATION

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

In Microsoft Excel, if you enter the text "good" and then press ALT+ENTER

and then type the text "guy" in a cell on a worksheet while the macro

recorder is running, the code appears as follows in the recorded procedure

   ActiveCell.FormulaR1C1 = "good||guy"

where || is a "box" character.

If you copy this line, and paste it to another location in the

procedure or module, it appears as follows:

   ActiveCell.FormulaR1C1 = "good"

   guy ""

When you run this procedure, you receive the following error message:

   Sub or function not defined

If the recorded procedure appears as follows

   ActiveCell.FormulaR1C1 = "goodguy||"

where || is a "box" character, then pasting this text to another

location results in the following:

   ActiveCell.FormulaR1C1 = "good guy"

You receive a syntax error when you run the procedure that contains this

line.

For more information about character codes, such as the ANSI or ASCII

Character Set, or the Character Set (0-127), choose the Search button in

the Visual Basic Reference and type:

    character codes

For more information about the Chr Function, choose the Search button in

the Visual Basic Help and type:

    Chr

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 5.00c macro paste chart


XL: Error Editing/Saving File When Can't Access File on Disk

Article ID: Q114440

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you remove a floppy disk or disconnect from a

network drive that contains a workbook file that you are editing, an

error message appears when you continue editing the workbook. The

error message that you receive depends on the data that is contained

in the workbook you are editing and the types of changes you make to the

workbook. The following is a summary of these error messages and when

you receive them.

Linked or Embedded Object

-------------------------

If the workbook contains a linked or embedded object, when you edit

the object or create another object, you receive the following error

messages:

 - Editing or inserting an embedded or linked object

      Cannot start source application

 - Pasting a new linked or embedded object

      Cannot paste data

Visual Basic Module

-------------------

If the workbook contains a Visual Basic module, and you try to run a

procedure contained in the module, or to insert a new module in the

workbook, you receive the following error message:

   Unable to read from the disk

Pivot Tables

------------

If the workbook contains a pivot table, and you attempt to edit the

pivot table, the following error message appears:

   Unable to obtain PivotTable data from disk

Note that you can create a new pivot table in the workbook under the

above conditions without receiving an error message, even if the

workbook already contains a pivot table.

Saving File

-----------

When you save a workbook file to another location, such as your hard disk

drive, the following error message appears if the workbook file contains a

pivot table, linked or embedded object, or a Visual Basic module, and you

do not have access to the disk that contains the workbook file:

   Document not saved

Note that when you save a workbook that contains a Visual Basic

module, you may also receive the following error message:

   Unable to write to the disk

CAUSE

=====

In Microsoft Excel version 5.0, workbook files are not stored

entirely in memory. Some elements of the workbook are stored on the

disk your file is stored on. This is a change from the way the

earlier versions of Microsoft Excel stored files.

When you create a pivot table, an OLE object, or a Visual Basic

module in a workbook, you must have continuous access to the drive that

contains the workbook, because these items are stored on the drive.

WORKAROUND

==========

To avoid running into problems when you are working on files off of a

floppy or a network drive, do not remove the floppy or disconnect

from the network drive until you have closed the file you are working

on.

To avoid receiving an error message in any of the above situations,

you must insert the floppy disk, or connect to the network drive that

contains the workbook file. You can then edit and create OLE objects,

pivot tables and Visual Basic modules, and you can also save the

workbook file.

MORE INFORMATION

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

When you open a new workbook file in Microsoft Excel, two temporary

files are created in your TEMP directory. The location of your TEMP

directory is determined by the SET TEMP statement in your

AUTOEXEC.BAT file. The two temporary files have names similar to the

following:

   ~1808.TMP

   ~DFT180D.TMP

These files created because Microsoft Excel version 5.0 uses the

Docfile format in object linking and embedding (OLE) version 2.0.

When you open an existing workbook, a temporary file is created

either in your TEMP directory or in the directory that contains the

file.

KBCategory: kbnetwork

KBSubcategory:

Additional reference words: 7.00 5.00 err msg


XL: Incorrect Polynomial Trendline on XY (Scatter) Chart

Article ID: Q114629

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you add a third-order polynomial trendline to an

xy (scatter) chart, and you display the equation, both the trendline

and the equation displayed on the chart are incorrect.

CAUSE

=====

This behavior is most noticeable when you are working with an xy (scatter)

chart, and the x values that are fairly close together relative to their

absolute size (that is, the x range is < 20-percent of the mean x value).

The degree to which the polynomial equation is incorrect depends on the

chart data, both the absolute size and size of the range. The greater the

order of the polynomial that you choose for the trendline, the greater the

amount of error in the trendline equation. Also, the greater the chart data

values, the lower the order of the polynomial that displays incorrectly.

Additionally, the amount of error in the trendline equation is greater when

your data sample is smaller than 5 points.

WORKAROUND

==========

Use the following suggestions to avoid this behavior or to at least

minimize the error in the trendline equation when you add a polynomial

trendline to your xy (scatter) chart:

 - Use a large number of data points on your chart (that is, more than 5).

 - Use the second- or third-order polynomial for the trendline, instead of

   a higher order polynomial.

 - Use smaller numbers, and a greater range of data points on your chart.

 - Use the steps in the following procedure to give the trendline formula a

   greater number of significant digits:

   1. With the right mouse button, click the equation.

   2. Choose the Format Data Labels command from the shortcut menu.

   3. Select Number tab, and select the Scientific category.

      The code will be displayed as "0.00E+00."

   4. Add more zeros between the "0.00" and the "E," so that the code

      resembles the following example, and then click OK:

         0.00000000E+00

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

REFERENCES

==========

For more information about Adding A Trendline To A Data Series, choose the

Search button in Help and type:

   trendlines

KBCategory: kbother

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c regression


XL: Error Opening 4.0 Workbook with Unbound File on Network

Article ID: Q114952

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you open a Microsoft Excel version 4.0 workbook

file that contains an unbound document file, you receive the following

error message:

   Filename is not valid

followed by the error message:

   Cannot load an empty Microsoft Excel 4.0 Workbook

CAUSE

=====

This behavior occurs if the unbound document file is located on a

network drive, and you do not currently have access to that network

drive. In Microsoft Excel version 5.0, you cannot open a Microsoft

Excel version 4.0 workbook file that does not contain any worksheets.

Because of this, if the only worksheet in a Microsoft Excel version

4.0 workbook is unavailable, you cannot open the workbook file in

Microsoft Excel version 5.0.

WORKAROUND

==========

To open a workbook that contains an unbound worksheet that is located

on a network drive, do either of the following:

 - Connect to the network drive where the unbound document that is

   contained in the workbook file is located.

   -or-

 - Open the file in Microsoft Excel version 4.0. You still receive the

   error message "Filename is not valid"; however, the workbook file is

   opened and you can view the path to the worksheet in the Workbook

   Contents window. Once you know the network path to the file, you can

   connect to the network drive again and open the unbound worksheet.

REFERENCES

==========

For more information about What Happens When I Open My Old Microsoft

Excel Files In Version 5.0?, choose the Search button in Help and

type:

    opening version 4.0 files

Additional reference words: 5.00 err msg

KBCategory: kbusage

KBSubcategory:


Incorrect Margin Using Fit To Scaling Option with PostScript

Article ID: Q114956

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use the Fit To scaling option to fit

your worksheet on a certain number of pages, the scaling factor may

be incorrect, causing an incorrect right margin.

CAUSE

=====

This behavior occurs when you use a PostScript printer driver, such

as the Apple LaserWriter, or the HP LaserJet IIISi PostScript driver.

This problem does not occur with all worksheets; the size of the worksheet

and the number of pages you enter in the Fit To box also affect this

behavior.

Note that this behavior also occurs when you are running the Windows

NT operating system.

WORKAROUND

==========

To correct this behavior, you can manually choose a scaling percentage

value that gives the correct margin for the worksheet. For example, if you

choose the Fit To option, and the set percentage (for example, 37%) causes

a right margin that is too large, you can change the scaling factor to a

larger number to decrease the right margin.

Do the following to set the scaling factor:

Microsoft Excel version 5.0

---------------------------

1. From the File menu, choose Page Setup.

2. Select the Page tab.

3. Under Scaling, select the Adjust To option. In the Adjust To box,

   increase the current percentage value.

View the worksheet in print preview to determine the correct scaling

factor.

Microsoft Excel version 4.0

---------------------------

1. From the File menu, choose Page Setup.

2. Under Scaling, select the Reduce/Enlarge To option. In the

   Reduce/Enlarge To box, increase the current percentage value.

View the worksheet in print preview to determine the correct scaling

factor.

Note that this behavior does not occur when you use a non-PostScript

printer, such as the HP LaserJet III.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft

products listed at the beginning of this article. We are researching

this problem and will post new information here in the Microsoft

Knowledge Base as it becomes available.

REFERENCES

==========

For more information about Reducing Or Enlarging What You Want To

Print, choose the Search button in Help and type:

   scaling

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 4.00 4.00a 5.00 pscript.drv pscript 2 ii

nt


XL: Text to Columns May Yield Incorrect Results

Article ID: Q115074

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the Text To Columns command on the Data menu makes it

easier to parse text from one column to the adjacent columns; this command

also allows you control the column delimiter.

However, when you use this command, the results may not be what you expect.

For example, leading zeros (0) may be dropped, and numbers that should be

formatted as text are instead formatted as dates or scientific numbers

(even when the source and destination columns have been formatted with the

Text format).

WORKAROUND

==========

To parse the text strings and maintain the desired formatting, do the

following:

1. Select the range of data to parse.

2. From the Data menu, choose Text To Columns.

3. In step 1 of the Text Import Wizard, choose either Delimited or Fixed

   Width (depending on the layout of your data), and then choose Next.

4. In step 2 of the Text Import Wizard, select the proper Delimiter for you

   data, and then choose  Next.

5. In step 3 of the Text Import Wizard, select each column and choose the

   Text option under the  Column Data Format (do this for each column).

6. Choose Finish.

7. To save your file as a Microsoft Excel file, choose Save As from the

   File menu, and, under File Type, select the Microsoft Excel Workbook.

MORE INFORMATION

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

A Microsoft Application Note is also available on Text importing. For

information about what this Application Note discusses and how you can

obtain it, see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q102142

   TITLE     : "Excel AppNOTE: Opening and Saving Text Files (ME0802)"

   ARTICLE-ID: Q99844

   TITLE     : "Excel AppNOTE: Opening and Saving Text Files (WE0801)"

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 text import wizard


XL: Error Calling Macro Contained in Open Add-In

Article ID: Q115208

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

When you call a macro that is contained in an add-in file, either by using

the Call statement or by using the macro name in a Visual Basic procedure

in Microsoft Excel, you receive the following error message, even if the

add-in that contains the macro is open at the time:

   Sub or Function not defined

CAUSE

=====

This behavior occurs when the add-in that contains the macro that you are

calling is not selected in the References dialog box. When you open an add-

in file, the add-in is added to the References dialog box, but is not

selected. This is by design of Microsoft Excel.

WORKAROUNDS

===========

To avoid receiving an error message when you call a macro that is contained

in an add-in file from a Visual Basic procedure, do either of the

following:

 - Open the add-in file (either before you run the macro, or as a command

   in the macro), and then use the Run method of the Application object to

   run the macro as in the following example:

      Application.Run("ADDIN.XLA!Macro_Name")

   -or-

 - Reference the add-in from the procedure that is calling the add-in macro

   with the following steps. (Note that when you use this procedure, the

   path to the add-in file is hard-coded in the module, so that in order

   to run the procedure, the add-in file must be located in the same

   directory as when you referenced it.)

   1. Activate the module that contains the procedure that is running the

      add-in macro.

   2. From the Tools menu, choose References.

   3. If the add-in that contains the macro you want to run is not listed

      under Available References, choose Browse.

   4. From the File Name list, select the add-in you want to reference and

      choose OK. Choose OK again.

MORE INFORMATION

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

When you use the References dialog box to directly reference another

workbook, add-in, or object library file, you can run a macro contained in

the referenced file using the Call statement and the macro name, or only

the macro name.

For more information about running a macro that is contained in an add-in,

query on the following words in the Microsoft Knowledge Base:

   tools and references and addin and run

REFERENCES

==========

For a definition of a Referenced Project, choose the Search button in

Help and type:

   referenced project

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00 err msg


XL: Control Method of Sheet Class Failed with Grouped Control

Article ID: Q115312

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In a Visual Basic module in Microsoft Excel, when you use the Value

property to set the property of a control, or return the property of

a control contained on a worksheet or dialog sheet, you receive the

following error message if the control is grouped

   Run-time error '1004':

   <controlname> method of Worksheet class failed

where controlname is the name of the control such as OptionButtons,

or CheckBoxes.

Note that controlname in the error message may also be DrawingObjects, if

you use the DrawingObjects method to return the control object.

CAUSE

=====

This behavior is by design in Microsoft Excel. When you select multiple

controls, and group them, the controls are now treated as a single object.

This makes it easier to move the controls, because they move together, but

you can no longer modify the properties of an individual control.

Note that when you select a grouped object, such as a check box, and choose

Object from the Format menu, there is no Control tab to set the value of

the check box to checked or mixed.

WORKAROUND

==========

To avoid this behavior, you must ungroup the control before you can set the

properties of an individual control, such as setting the value of an Option

Button to selected, or the value of a Check Box to clear (unchecked).

MORE INFORMATION

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

For more information about verifying the value of a check box, query on the

following words in the Microsoft Knowledge Base:

   value and check and box and xlon

REFERENCES

==========

"Visual Basic User' Guide," version 5.0, Chapter 11, "Controls and

Dialog Boxes"

For more information about the Value Property, choose the Search

button in the Visual Basic Reference and type:

   Value Property

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 1.00 5.00 err msg drawing


XL: Visual Basic Macro to Convert Lotus Files to Excel

Article ID: Q115343

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

Microsoft Excel versions 5.0 and later can read Lotus 1-2-3 worksheets. In

addition, you can create a Visual Basic, Applications Edition, procedure to

automatically open each Lotus 1-2-3 file in a specified directory and save

it as a Microsoft Excel workbook file (.XLS).

The macro example in the "More Information" section of this article

demonstrates a looping procedure you can use to perform this action. The

example provided does not delete the original Lotus files, and it will

prompt you if a file with the same name is about to be overwritten.

NOTE: If you are using Microsoft Excel version 5.0 or 5.0c, you need to use

the "Lotus 1-2-3 WK4 File Converter" in order to read Lotus 1-2-3 version

4.0 files. This converter is available as an Application Note. For

additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q122583

   TITLE     : XL5: AppNote: Lotus 1-2-3 WK4 File Converter (WE1130)

MORE INFORMATION

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

Before you run the macro, make sure the directory where the Lotus 1-2-3

files are located is set as the current directory. Click Macro on the Tools

menu, and click "LotusConverter" from the list of macros, and then click

Run. The macro will proceed without your intervention unless a duplicate

filename is found (in which case you will be prompted to change the

duplicate filename).

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Visual Basic Code Example

-------------------------

'Begin the subroutine

Sub LotusConverter()

'Set "filenam" to the first matching file in the current directory

filenam = Dir("*.wk*")

'Loop to open each matching file in the current directory

Do While Len(filenam) > 0

   On Error Resume Next

   'Opens the file

   Workbooks.Open Filename:=filenam

   'Continues execution if there was no error opening the file.

   If Err = 0 Then

      'Creates "newname" based on original Lotus filename

      newnam = Left(filenam, InStr(1, filenam, ".") - 1) & ".xls"

      'Saves the new file as an Excel normal file

       ActiveWorkbook.SaveAs Filename:=newnam, FileFormat:=xlNormal

      'Closes the current file

      ActiveWorkbook.Close

   Else

      'Display message if opening filenam was unsuccessful.

      MsgBox "Unable to Open file: " & filenam

      'Resets error checking.

      Err = 0

   End If

   'Gets the next file name

   filenam = Dir()

'Repeats the loop for all matching files in the current directory

Loop

End Sub

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Pivot Table Cannot Group Data

Article ID: Q115471

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

When you attempt to group items in a pivot table, you may receive the

following error message:

   Cannot group that selection.

CAUSE

=====

A pivot table range containing a blank row is interpreted as an incorrect

data type and, therefore, Microsoft Excel does not allow you to group the

data.

WORKAROUND

==========

To group the data in the pivot table, do the following:

1. Remove all blank rows from the pivot table data range.

2. Do the following to refresh the pivot table:

   a. Select any item in the pivot table.

   b. From the Data menu, choose Refresh Data.

MORE INFORMATION

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

To group data in a pivot table, do the following:

1. Select a range of data in the pivot table.

2. From the Data menu, choose Group And Outline, and then choose Group.

The items are then grouped according to similar items such as dates or

times. However, when a blank row occurs in the pivot table data range, the

data cannot be grouped. A blank row is interpreted as a null value, which

cannot be included as part of the grouped data.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 database


XL: Row and Column Range Converted to Two-Dimensional Array

Article ID: Q115513

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Visual Basic Programming System, Applications Edition,

   version 1.0

--------------------------------------------------------------------

SUMMARY

=======

Page 127 of the "Visual Basic User's Guide," states that a Microsoft Excel

horizontal or vertical array is converted to a one-dimensional Visual Basic

array. This information is not entirely correct: when you define a variable

in a procedure as a row or a column of cells on a worksheet, the variable

is converted to a two-dimensional array.

Note, that the examples used on page 127 of the "Visual Basic User's Guide"

ARE correct. A horizontal or vertical array such as {"Apples",7,19} or

{"Apples";7;19} is converted to a one-dimensional Visual Basic array.

MORE INFORMATION

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

In Microsoft Excel, if you dimension a row or column of cells on a

worksheet as an array in a Visual Basic module, and you return a value in

the array as an element of a one-dimensional array, you receive the

following error message:

   Run-time error '9':

   Subscript out of range

To avoid receiving the error message above when you return a value

from a variable that has been defined as a worksheet row or column,

return the value as an element of a two-dimensional array as in the

following example.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

Sample Visual Basic Macro

-------------------------

   ' Dimension variable Column_Variable as Variant type

   Dim Column_Variable as Variant

   ' Assign variable Column_Variable to named range Vert

   ' Vert contains the vertical range A1:A3

   Column_Variable = ThisWorkbook.Sheets("Sheet1").Range("Vert")

   ' Return value in A2, element in second row, first column in array

   MsgBox Column_Variable(2, 1)

REFERENCES

==========

For more information about Creating Arrays, choose the Search button

in the Visual Basic Reference and type:

    arrays

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 1.00 5.00 err msg docerr


XL5: AutoFormat Page Setup Options Not Applied to Chart

Article ID: Q115514

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you apply a user-defined chart AutoFormat to

an embedded chart, the Page Setup options in the AutoFormat are not

applied.

CAUSE

=====

When you create a user-defined chart AutoFormat, from either an

embedded chart, or a chart contained on its own sheet, the Page Setup

options are saved in the AutoFormat along with the chart formatting.

When you apply the user-defined AutoFormat to an embedded chart, the Page

Setup options such as orientation and header/footer information are not

copied to the chart.

WORKAROUND

==========

When you apply a user-defined AutoFormat to an embedded chart, you

must manually change the Page Setup options, such as margins and

orientation, to the desired settings.

Note that when you apply a user-defined AutoFormat to a chart sheet,

the Page Setup options contained in the AutoFormat ARE copied to the

chart.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows 95, version 7.0.

MORE INFORMATION

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

REFERENCES

==========

For an Overview Of Working With Chart Autoformats, choose the Search

button in Help and type:

   autoformats, chart

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00


XL: Non-Loop Array Transfer to a Worksheet

Article ID: Q115776

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The most common way to transfer the contents of a named array to a

worksheet is through a loop such as a For Next loop. A For Next loop

indexes the array and inserts one element of the array to the

destination address at a time.

You can accomplish this same result without a loop using the Visual Basic,

Applications Edition, FormulaArray property of the Range object.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

In Visual Basic, Applications Edition, the orientation of a one-dimensional

array is horizontal. Therefore, if the range of cells on the worksheet that

are to receive the contents of the array are also in the same orientation

(that is, one row by several columns), the contents can be transferred with

a single FormulaArray statement.

For example:

'For a One dimensional horizontal array

Sub arraydump1()

    'Declares an array of size 10

    Dim x(1 To 10) As Double

    'Calculates random values

    For j = 1 To 10

        x(j) = j * j

    Next j

    'Transfers array contents to a horizontal area

    Range(Cells(2, 1), Cells(2, 10)).FormulaArray = x

End Sub

The above example works fine when the destination worksheet cells involve

one row. However, when the contents of an array need to be transferred to a

range of cells with a vertical, as opposed to a horizontal orientation

(that is, one column by several rows), the above example is no longer

valid.

In the event that multiple rows of data are within the two-dimensional

array, you must change the orientation of the array. To do this, you can

declare the array a two-dimensional array with dimensions of several rows

by one column.

For example:

'For a two dimensional vertical array

Sub arraydump2()

    'Declares an array ten rows by one column

    Dim x(1 To 10, 1 To 1) As Double

    'Calculates random values

    For j = 1 To 10

        x(j, 1) = j * j

    Next j

    'Transfers array contents to a vertical area

    Range(Cells(1, 2), Cells(10, 2)).FormulaArray = x

End Sub

The two-dimensional array shown in this example allows Visual Basic to set

the orientation of the array as vertical; therefore, the array can be

transferred to a worksheet without a loop.

REFERENCES

==========

For more information about FormulaArray choose the Search button in

Visual Basic Help and type:

   FormulaArray

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


Excel: Explanation of Recursive Calculation and Evaluation

Article ID: Q115941

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0

 - Microsoft Excel for OS/2, version 2.2, 3.0

 - Microsoft Excel for the Macintosh, version 2.x, 3.0, 4.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the sequence of evaluation can cause unexpected results

when a macro is called as part of a formula. If a single formula invokes a

macro and subsequently references a defined name or cell modified by that

macro, the defined name or cell will be evaluated differently than it would

have been prior to the calculation of the formula.

MORE INFORMATION

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

Microsoft Excel evaluates formulas from left to right. For example, when

Microsoft Excel calculates the following formula

   =FORMULA(5,B1)+B1

the cell B1 is assigned the value of 5 prior to adding the cell B1. This

formula will return a value of 6 (TRUE+5) regardless of the value in B1

prior to evaluation.

If you want to add the existing value in B1 prior to modifying B1, then you

should reverse the sequence of the expressions, as in the following

example:

   =B1+FORMULA(5,B1)

This behavior can cause unexpected results when a formula calls a macro

that modifies a defined name or cell referenced in the formula after the

macro is invoked. In the previous example, B1 was explicitly modified

within the formula. When a macro is invoked as part of the formula, the

defined names and cells modified by the macro are not as obvious.

The following function macro attempts to reverse the order of the

characters in the text string passed to it. It performs this recursively by

passing the string minus the first character back to itself until the

length of the string is evaluated as one. Then, as each instance of the

function terminates, the calling instance concatenates the initial first

character onto the end of the string.

   A1: Reverse

   A2: =ARGUMENT("MyText")

   A3: =IF(LEN(MyText)=1,RETURN(MyText))

   A4: =RETURN(Reverse(MID(MyText,2,255))&LEFT(MyText,1))

In this example, the value passed from the first instance to the second

instance would be the text "MyText" minus the first character. Each

subsequent instance of the Reverse function will redefine the name MyText

as the text of MyText less one additional character, until the final

instance which then defines MyText as just one character.

When the last instance terminates and returns the single character, the

calling instance will then concatenate the remaining single character with

the left-most character of MyText, which is the same single character. The

name MyText, when it was first evaluated in the MID function contained a

two-character string. After invoking the last instance of "Reverse" and

then returning to complete the evaluation of A4, the name MyText contains a

one character string. The result is that in each instance, as it evaluates

LEFT(MyText,1), MyText will contain the single character passed to the last

instance of "Reverse," since that was the last time the name MyText was

defined. The value of the name MyText has changed during each evaluation of

A4.

The result of "Reverse" will always be a string with the same number of

characters as the original argument, but each character is the last

character of the original string. The result of =REVERSE("Sample") would be

"eeeeee."

The following corrected version of "Reverse" illustrates the problem

and how to avoid it. This example starts at the end of the string,

instead of starting at the beginning of the string, and extracts the

last character to concatenate to the remaining string prior to

passing the remaining string to the next instance.

   A1: Reverse

   A2: =ARGUMENT("MyText")

   A3: =IF(LEN(MyText)=1,RETURN(MyText))

   A4: =RETURN(RIGHT(MyText,1)&reverse(LEFT(MyText,LEN(MyText)-1)))

In this example, the defined name MyText will change during the

evaluation of A4, but the function RIGHT(MyText,1) will be evaluated

before the subsequent instances of "Reverse" redefine MyText. By

invoking the next instance of "Reverse" after evaluating RIGHT, this

version of MyText is correctly used.

For more information about recursive functions in Microsoft Excel, query

on the following words in the Microsoft Knowledge Base:

   routines and function and recursive and macro

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 expression incorrect order calculate


XL: VB Macro to Change Between Relative/Absolute References

Article ID: Q116028

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can use the ConvertFormula method in a Visual

Basic, Applications Edition, procedure to convert cell references from A1

reference style to R1C1 reference style. This method will also allow you to

change from an absolute to a relative reference and vice versa.

MORE INFORMATION

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

The following sample Visual Basic procedure uses the ConvertFormula method

to convert A1 relative references to R1C1 absolute references or A1

absolute references to R1C1 relative references for a selected range.

You can also use this procedure to convert cell references between A1 and

R1C1 reference style by changing the appropriate constants for

"fromReferenceStyle" and "toReferenceStyle" for the ConvertFormula method.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Macro Example

-------------

'Convert_Reference Type Macro

'A Visual Basic module to convert absolute references to relative

'references or relative references to absolute references.

Sub Conv_RefType()

Dim Conv As String

'Prompt user to change to relative or absolute references

Conv = Application.InputBox _

("Type A to convert to Absolute, R to Relative Reference(s)", _

"Change Cell Reference Type")

'If changing relative to absolute references

If UCase(Conv) = "A" Then

    'Loop through each cell selected

    For Each Mycell In Selection

        'Stores cell's formula as variable

        MyFormula = Mycell.Formula

        'Converts formula to absolute reference style

        NewFormula = Application.ConvertFormula _

        (Formula:=MyFormula, _

        fromReferenceStyle:=xlA1, _

        toReferenceStyle:=xlA1, _

        toAbsolute:=xlAbsolute)

        'Replaces old formula with new absolute formula

        Mycell.Formula = NewFormula

    Next

'If changing absolute to relative references

ElseIf UCase(Conv) = "R" Then

    'Loop through each cell selected

    For Each Mycell In Selection

        'Stores cell's formula as variable

        MyFormula = Mycell.Formula

        'Converts formula to relative reference style

        NewFormula = Application.ConvertFormula _

        (Formula:=MyFormula, _

        fromReferenceStyle:=xlA1, _

        toReferenceStyle:=xlA1, _

        toAbsolute:=xlRelative)

        'Replaces old formula with new relative formula

        Mycell.Formula = NewFormula

    Next

'Display Error message if choice entered is invalid

ElseIf UCase(Conv) <> "FALSE" Then

    MyMsg = "Enter A for Absolute, R for Relative Reference(s)"

    MyTitle = "Option Not Valid"

    MyBox = MsgBox(MyMsg, 0, MyTitle)

End If

End Sub

REFERENCES

==========

For more information about ConvertFormula, choose Search from the

Visual Basic Help menu and type:

   ConvertFormula

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: Pressing F1 on Custom Dialog May Not Activate Help Button

Article ID: Q116059

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel version 5.0, it is possible to format one button in a

dialog box as a Help button. If the dialog box is active and you press F1

on the keyboard, this button should be activated and any macro assigned to

it should run.

This does not happen, however, if an edit box, list box, drop-down,

or scroll bar is the active item on the dialog box. Pressing F1

while any of these items is active has no effect.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows 95, version 7.0.

KBCategory: kbprb

KBSubcategory:

Additional reference words: 5.00


XL: Visual Basic Example of Spinner Use on a Date

Article ID: Q116118

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

----------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed above, you can use a spinner

control to change values on a worksheet or in a Visual Basic procedure. In

order to use the spinner to both increment and decrement a value over a

wide range, the spinner must be set and used in conjunction with another

value or cell to calculate both positive and negative values.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

The following Visual Basic macro example demonstrates how to use a spinner

control to both increment and decrement a date value in an edit box.

Visual Basic Macro Example

--------------------------

To create the sample dialog box and macro code:

1. In a new workbook, choose Macro from the Insert menu, and then choose

   Dialog.

2. Use the tools on the Forms toolbar to create one edit box, and one

   spinner on the dialog sheet.

3. From the Insert menu, choose Macro, and then choose Module. In the new

   module sheet, enter the following Visual Basic macro code:

   Public OldSpin As Integer

   'Defines variable called "OldSpin" as an integer, and makes it available

   'to all subroutines

   Sub ShowDialog()

   'This routine initializes the spinner and OldSpin to a value of 15000,

   'populates the edit box with today's date, and displays the dialog box.

      OldSpin = 15000

     'Sets OldSpin to 15000

      DialogSheets(1).Spinners(1).Value = OldSpin

      'Sets the current spinner value to 15000

      DialogSheets(1).EditBoxes(1).Text = Date

      'Sets the edit box to today's date

      Dialogsheets(1).Show

      'Display the dialog box

   End Sub

   'Ends the subroutine

   Sub SpinDate()

   'This routine is assigned to the spinner to run when you choose the

   'spinner. It will determine the difference between the current spinner

   'value and OldSpin, and use the difference to increment or decrement the

   'date in the edit box.

      DialogSheets(1).EditBoxes(1).Text = _

         DateValue(DialogSheets(1).EditBoxes(1).Text) - OldSpin + _

         DialogSheets(1).Spinners(1).Value

      'Sets the edit box value based on the difference

      'between OldSpin and the spinner value

      OldSpin = DialogSheets(1).Spinners(1).Value

      'Resets OldSpin to the spinner value

   End Sub

   'Ends the subroutine

'   -----------------

   Once you enter this code, you will have two macros on the module,

   ShowDialog and SpinDate. These macros will be used with the dialog box

   that you created in step 1.

To assign the SpinDate macro to the spinner:

1. Select the spinner control, and choose Assign Macro from the Tools menu.

2. From the Assign Macro dialog box, select the SpinDate Macro, and choose

   OK.

To run the ShowDialog macro:

1. Choose Macro from the Tools menu.

2. In the Macro dialog box, select the ShowDialog macro, and choose Run.

The spinner will increment or decrement the date in the edit box. (By

default, this date is the current date.) You can enter a different date

manually.

REFERENCES

==========

For more information about Spinners, choose Search in Visual Basic Help and

type:

   Spinner

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XLM: Importing Text Files Larger Than 16384 Rows

Article ID: Q116232

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0 5.0c

 - Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

Text files that contain more than 16384 rows cannot be opened in their

entirety in Microsoft Excel. You cannot open these files because a

worksheet is limited to 16384 rows. If you open a file that contains more

data than this, the size will produce the following error message

   File not loaded completely

and the text file will be truncated at the 16384th row. However, you can

use a macro to open the file and automatically break the text into multiple

worksheets.

MORE INFORMATION

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

The following sample macro prompts the user for a text filename, opens the

file into memory, and determines if the number of rows is larger than

16384. If the number of rows is beyond the Microsoft Excel worksheet limit,

the macro breaks the file into multiple worksheets.

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided 'as is' and Microsoft does not guarantee that the

following code can be used in all situations. Microsoft does not support

modifications of the code to suit customer requirements.

Enter the following macro into a macro sheet:

A1:  Large_Text_File_Importer

A2:  filename=INPUT("Please enter the Text File's name",2,"Large Text

     File Importer")

A3:  =IF(filename=FALSE,RETURN())

A4:  filenum=FOPEN(filename,2)

A5:  =ECHO(FALSE)

A6:  =NEW(1)

A7:  Counter=1

A8:  =WHILE(FPOS(filenum)<=FSIZE(filenum))

A9:  =MESSAGE(TRUE,"Importing Row "&Counter&" of text file "&filename)

A10: =FORMULA(FREADLN(filenum))

A11: =IF(ROW(ACTIVE.CELL())=16384)

A12: =NEW(1)

A13: =ELSE()

A14: =SELECT("R[1]C")

A15: =END.IF()

A16: Counter=Counter+1

A17: =NEXT()

A18: =FCLOSE(filenum)

A19: =MESSAGE(FALSE)

A20: =RETURN()

Description of macro code:

A1:  Name of the Macro

A2:  Prompt user for the Text file's name (with complete path and file

       extension).

A3:  If input box cancel button was selected, then end macro.

A4:  Open the Text file with Read access.

A5:  Turn screen updating off.

A6:  Create a new worksheet

A7:  Initialize the row Counter name to the value of 1.

A8:  Loop until we reach the end of the file.

A9:  Display a status message at the bottom of Excel.

A10: Read a line from the text file and place into the active cell.

A11: Check to see if the current row is 16384.

A12: If A12 is True, then create a new sheet.

A13: If A12 is NOT True, then do the following...

A14: Select 1 row down from the active cell.

A15: End the IF block.

A16: Increment the Counter name by 1.

A17: Loop back to A9.

A18: Close the text file (opened in cell A4).

A19: Turn the status bar back to normal.

A20: End Macro.

NOTE: This macro does not parse the data into columns. After you use this

macro, you may also need to do the following:

 - If you are using Microsoft Excel 5.0, use the Text To Columns command on

   the Data menu.

   -or-

 - If you are using Microsoft Excel 3.0, 4.0, or 4.0a, use the Data Parse

   command or the Smart Parse command FLATFILE.XLA add-in macro.

Note also that, because this is a macro, it may be significantly slower

than choosing the Open command from the File menu.

REFERENCES

==========

KBCategory: kbprg kbmacro

KBSubcategory:

Additional reference words: 3.00 4.00 5.00 import ascii


XL: Visual Basic Procedures for Julian Date Calculations

Article ID: Q116281

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

This article describes how to convert between the serial date, normal date,

and Julian date formats using Visual Basic, Applications Edition

procedures.

MORE INFORMATION

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

Microsoft Excel normally stores date values as serial numbers. For example,

January 1, 1994, is stored as the number 34335. The serial number 1,

represents January 1, 1900. All of these calculations are based on the 1900

date system.

Julian dates are used to show the number of days that have passed and/or

that are left in a given year. The format for a Julian date is the

following:

   yyddd

Where 'yy' is the year and 'ddd' is the day of the year. Below are examples

of serial, normal, and Julian date equivalents:

Serial date          Normal date          Julian date

-----------          -----------          -----------

34335                Jan-01-1994             94001

34699                Dec-31-1994             94365

The following Visual Basic procedures convert from Julian to Serial, Serial

to Julian, and Normal Date to Julian. The last two procedures show how to

find the day of the year for the current date and how many days are left in

the year.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

'This procedure takes a Julian date (yyddd) entered in an Input Box

'and converts it to the appropriate serial date.

Sub JulianToSerial()

  'Holds the value of the string entered in the Input Box.

  Dim JulianDate As Long

  'The converted serial date value.

  Dim SerialDate As Date

  'Prompt for input and assign the value entered to the

  'JulianDate variable.

  JulianDate = Val(InputBox("Enter the Julian date (yyddd):"))

  'Convert the Julian date to a serial date.

  SerialDate = DateSerial(1900 + Int(JulianDate / 1000), 1, _

     JulianDate Mod 1000)

  'Display the new date in the normal date format.

   MsgBox "The equivalent date is " & SerialDate

End Sub

'This procedure takes a serial date number entered in an Input Box

'and converts it to the appropriate Julian date and returns it as a

'string.

Sub SerialToJulian()

    Dim SerialDate As Date      'The serial date.

    Dim SerialYear As String    'The year of the serial date.

    Dim JulianDay As String

    Dim JulianDate As String    'The converted Julian date value

    'Prompt for input and assign the value entered to the

    'SerialDate variable.

    SerialDate = Val(InputBox("Enter the serial date to convert:"))

    'Assign SerialYear the year number

    SerialYear = Format(SerialDate, "yy")

    'Find the day number for SerialDate

    JulianDay = Format(Str(SerialDate - DateValue("1/1/" & _

    Str(SerialYear)) + 1), "000")

    JulianDate = SerialYear & JulianDay

    'Display the new date in the normal date format.

    MsgBox "The equivalent Julian date is " & JulianDate

End Sub

'This procedure takes a normal date format (that is, 1/1/94) entered in

'an Input Box and converts it to the appropriate Julian date.

Sub NormalToJulian()

    Dim CRLF As String          'Carriage return/line feed.

    Dim NormalDate As Date      'The serial date.

    Dim DateYear As String      'The year of the serial date.

    Dim JulianDay As String

    Dim JulianDate As String    'The converted Julian date value

    'Assign CRLF the value of a carriage return and line feed.

    CRLF = Chr$(13)

    'Prompt for input and assign the value entered to the

    'NormalDate variable.

    NormalDate = DateValue(InputBox("Enter the date to convert:" & _

    CRLF & "Examples: " & CRLF & "1/1/94" & CRLF & "12/31/1994" _

    & CRLF & "Jan-05-94"))

    'Assign DateYear the year number

    DateYear = Format(NormalDate, "yy")

    'Find the day number for NormalDate

    JulianDay = Format(Str(NormalDate - DateValue("1/1/" & _

    Str(DateYear)) + 1), "000")

    'Combine the year and day to get the value for JulianDate.

    JulianDate = DateYear & JulianDay

    'Display the new date in the Julian date format.

    MsgBox "The equivalent Julian date is " & JulianDate

End Sub

'This procedure will return the number of days that

'have passed since January 1 of the current year.

Sub DaysPassed()

    Dim DayOfYear As Integer          'Number of the current day

    DayOfYear = Int(((Now / 365.255) - (Year(Now) - 1900)) * 365.255)

    'Display the value of DayOfYear

    MsgBox "Day of the year:  " & DayOfYear

End Sub

'This procedure will return the number of days left in the current year.

Sub DaysLeft()

    Dim JanNextYear As Date         'January 1 of next year

    Dim JanCurrentYear As Date      'January 1 of current year

    Dim DayNum As Integer           'Number of the current day

    Dim DaysLeftInYear As Integer   'Days left in the current year

    JanNextYear = DateSerial(1 + Year(Now), 1, 1)

    JanCurrentYear = DateSerial(Year(Now), 1, 1)

    DayNum = Int(((Now / 365.255) - (Year(Now) - 1900)) * 365.255)

    DaysLeftInYear = JanNextYear - JanCurrentYear - DayNum

    'Display the value of DaysLeftInYear

    MsgBox "Days left in the year:  " & DaysLeftInYear

End Sub

REFERENCES

==========

For more information about the DateSerial function, choose the Search

button in Visual Basic Help, and type:

   DateSerial

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 4.00 4.0a 5.00


Excel: Converting Multiple Rows/Columns to Columns/Rows

Article ID: Q116289

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.x, 4.x, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 3.x, 4.x, 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can use a worksheet formula to covert data that

spans multiple rows and columns to a database format (columnar).

MORE INFORMATION

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

The following example converts every three rows of data in a column

to three columns of data in a single row (similar to a database field

and record layout). This scenario is similar to what you would do when you

open a worksheet or text file containing data in a mailing label format.

Example

-------

1. In a new worksheet enter the following data:

      A1: Smith, John

      A2: 111 Pine St.

      A3: San Diego, CA

      A4: Jones, Sue

      A5: 222 Oak Ln.

      A6: New York, NY

      A7: Anderson, Tom

      A8: 333 Cherry Ave.

      A9: Chicago, IL

2. Enter the following formula:

      C1: =OFFSET($A$1,(ROW()-1)*3+INT((COLUMN()-3)),MOD(COLUMN()-3,1))

   Fill this formula across to column E and down to row three.

3. Select cells C1:E3.

4. Choose Copy from the Edit menu.

5. With the same range of cells selected choose Paste Special from the

   Edit menu and select Values. Choose the OK button.

The formula can be interpreted as follows

   OFFSET($A$1,(ROW()-f_row)*rows_in_set+INT((COLUMN()- f_col)/col_in_set),

   MOD(COLUMN()-f_col,col_in_set))

where:

   f_row = row number of this offset formula

   f_col = column number of this offset formula

   rows_in_set = number of rows which make one record of data

   col_in_set = number of columns of data

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 mailing labels


XL: Can't Trap No or Cancel in "Replace Existing" Dialog Box

Article ID: Q116327

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you use the SaveAs method of the Workbook

object to save a file, and you save the file with the same name and

location as an existing file, you cannot determine whether the No or

the Cancel button is chosen in the "Replace Existing" dialog box

that appears when you save the file.

CAUSE

=====

When you use the SaveAs method of the Workbook object to save a file,

and the file already exists, both the No and the Cancel button in the

"Replace Existing" dialog box cause the following error message to

appear:

   Run-time error '1004':

   SaveAs method of Workbook class failed

Because of this behavior, you cannot trap this error, and you cannot

determine in your macro whether the Cancel button was chosen, or the

No button was chosen.

WORKAROUND

==========

To work around this behavior, you can use the Dir function to

determine whether the file already exists, and then use the MsgBox

function to trap the response to either replace the existing file, or

not. The following macro is an example of this method.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

   Sub Save_File()

      ' Dimension variables

      Dim FileToSave, ExistFile, Msg As String

      Msg = "File already exists. Save on top of existing file?"

      ' Define name and directory to save active workbook to

      FileToSave = "C:\TEST.XLS"

      ' Check for existing file

      ExistFile = Dir(FileToSave)

      If ExistFile <> "" Then

         If MsgBox(Msg, vbExclamation + vbOKCancel) = vbOK Then

            ' OK chosen, replace following line with desired code

            MsgBox "Save over existing file"

         Else

            ' Cancel chosen, replace following line with desired code

            MsgBox "Cancel save"

         End If

      ' If file does not exist, save file

      Else

         ThisWorkbook.SaveAs ("C:\TEST.XLS")

      End If

   End Sub

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

REFERENCES

==========

"Microsoft Excel Visual Basic User's Reference" Chapter 9, "Handling

Errors and Error Values"

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


No Macro Function to Access Solver Dialog Box

Article ID: Q116340

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0

--------------------------------------------------------------------

SUMMARY

=======

The Solver add-in macro that ships with Microsoft Excel does not provide a

macro function to display the main Solver dialog box. However, you can

display this dialog box using the Run() macro command or the Run method in

a Visual Basic for Applications procedure.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Visual Basic for Applications Example

-------------------------------------

The following is an example using Visual Basic, Applications Edition:

   'Macro to call Solver main dialog box

   Sub MainSolverDialog()

       'Turn error checking off

       On Error Resume Next

       'Test if Solver add-in is already open

       If Application.IsNA(Workbooks("Solver.xla").Name) Then

           'If add-in is not open then open Solver.xla

           'Note you may need to adjust the path to Solver.xla. For example

           'the path may be "C:\MSOffice\Excel\Library\Solver\Solver.xla"

           Workbooks.Open ("C:\Excel\Library\Solver\Solver.xla")

           'Run Solver auto open macro to load add-in

           Application.Run ("Solver.xla!Auto_Open")

       'Ends the If statement

       End If

       'Turn error checking back on

       On Error GoTo 0

       'Run the Solver macro to display the main Solver dialog

       Application.Run ("Solver.xla!Do_Main")

   'End the macro

   End Sub

NOTE: You may need to adjust the path to Solver.xla.

Microsoft Excel 4.0 and 4.0a for Windows

----------------------------------------

   A1: Solver Main Dialog

   A2: =IF(AND(ISNA(DOCUMENTS(2,"SOLVER.XLA"))))

   A3: =OPEN("C:\EXCEL\LIBRARY\SOLVER\SOLVER.XLA")

   A4: =Run("Solver.xla!Auto_Open")

   A5: =END.IF()

   A6: =RUN("SOLVER.XLA!Do_Main")

   A7: =RETURN()

   Description of macro:

   A1: Name of macro.

   A2: Check to see if Solver is already opened.

   A3: If Solver is not open, open it.

   A4: Run Solver's auto open macro to load the add-in.

   A5: End the If function in A2.

   A6: Run the 'Do_Main' macro in the Solver add-in.

   A7: End the macro.

Microsoft Excel 4.0 for the Macintosh

-------------------------------------

   For the above macro to work with Microsoft Excel for the Macintosh,

   replace the MS-DOS style file name with the appropriate Macintosh style

   file name (for example, "Macintosh HD: Microsoft Excel: Macro Library:

   Solver: Solver Add-In").

KBCategory: kbprg kbcode kbmacro kbtool

KBSubcategory:

Additional reference words: 4.00 4.0a 5.00xlm


XL: Hidden Cells in a Worksheet May Become Unhidden

Article ID: Q117128

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, hidden cells in a worksheet may become unhidden if all

of the following conditions are true:

 - There is at least one hidden row or column in the worksheet.

   -and-

 - The Transition Navigation Keys option is enabled.

   -and-

 - You are creating a formula on another worksheet or workbook using Point

   mode, and you select a cell on the worksheet.

WORKAROUND

==========

To keep cells from becoming unhidden, do the following to turn the

Transition Navigation Keys option off:

1. From the Tools menu, choose Options, and then select the Transition tab.

2. Under Settings, clear the Transition Navigation Keys check box.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Excel version

5.0 for Windows. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

This problem does not occur in Microsoft Excel for the Macintosh version

5.0.

MORE INFORMATION

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

Point mode is a data entry mode that lets you create a formula by selecting

cells with the mouse or keyboard. The status bar will display the word

"Point" in the lower-left corner when you are in this mode. For example, in

point mode, if you activate a cell and press = (the equal sign), you can

select another cell by pressing the arrow keys on the keyboard or selecting

a cell with your mouse.

KBCategory: kbprb

KBSubcategory:

Additional reference words: 7.00 5.00


XL: "<Macro> On <Workbook> Is Not Defined" Updating Links

Article ID: Q117231

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you open a workbook that contains an object that

is linked to a macro in another workbook, and you choose to re-establish

the links contained in the workbook, you receive the following error

message

   'Macro' on 'Workbook' is not defined or is too complex

where Macro is the name of the macro that is assigned to the object, and

Workbook is the name of the workbook that contains the macro.

CAUSE

=====

When you assign a macro to an object, and the macro is contained in a

different workbook than the object, a link to the workbook that

contains the macro appears in the Links dialog box. If you choose to

update this link by using the Update Now button in the Links dialog

box, when the workbook that contains this macro is closed, the error

message above appears because this link cannot be updated. This error

message also appears if you choose to re-establish the links

contained in a workbook, and the workbook contains an object that is

linked to a macro in another workbook. This behavior is by design in

Microsoft Excel.

When you open a workbook that contains an object that is linked to a macro

in another workbook, and the workbook also contains a reference to a named

range in the same workbook, you are incorrectly prompted to re-establish

links in the workbook. (You are only prompted to re-establish links if the

Ask To Update Automatic Links check box is selected on the Edit tab in the

Options dialog box.) When you open a workbook that contains an object that

is linked to a macro in another workbook, and the workbook does not contain

any other external links, you should not be prompted to re-establish the

links when you open the workbook.

Note that the message to re-establish links does not appear under either of

the following circumstances:

 - You open a workbook that contains a reference to a named range on the

   same workbook and that reference does not contain an external link or

   object that is linked to a macro in another workbook.

   -or-

 - You open a workbook that contains an object that is linked to a macro in

   another workbook and does not contain an external link or reference to a

   named range in the same workbook.

WORKAROUNDS

===========

To avoid receiving this error message, do any of the following:

 - Clear the Ask To Update Automatic Links check box on the Edit tab of the

   Options dialog box. Note that this setting affects all workbooks.

   -or-

 - Open the workbook that contains the macro that is assigned to the object

   before you open the workbook that contains the object.

   -or-

 - Choose No when you are prompted to re-establish the links in the

   workbook that contains the object that is assigned to a macro in another

   workbook.

   -or-

 - Use cell references instead of using named references in the workbook

   that contains an object that is assigned to a macro in another workbook.

   Note that this workaround applies only to references to cells within

   the workbook, and does not apply to external references.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

REFERENCES

==========

For more information about Assigning A Macro To A Graphic Object or

Assigning A Macro To A Button On A Sheet, choose the Search button in

Help and type:

   assigning macros

KBCategory: kbprb

KBSubcategory:

Additional reference words: 7.00 5.00 err msg


XL: SQL.REQUEST and SQLREQUEST Function Syntax Differences

Article ID: Q117364

------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c, 7.0

------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed at the beginning of this article,

the arguments in the SQL.REQUEST function and the SQLREQUEST are the same

in the two functions, but the order of the arguments is different.

MORE INFORMATION

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

Two functions in the XLODBC.XLA add-in, SQLRequest (Visual Basic

function) and SQL.REQUEST (worksheet function and Microsoft Excel 4.0

macro function), allow you to connect to an external data source and

run a query. Most functions that are available as macro commands and

worksheet functions have the same syntax. This is not the case with

SQLRequest and SQL.REQUEST.

You can use the FunctionWizard to view the differences in the order of the

arguments in the two functions. The following sections contain correct

syntax for and an example of each function.

SQLRequest

----------

SQLRequest is a Visual Basic function. The correct syntax is as follows:

   SQLRequest(connectionStr, query, output, prompt, columnNames)

You can use this function in a formula on a worksheet, or in a Visual

Basic procedure. Note that the SQLRequest function syntax shown in

the FunctionWizard is as follows (different argument names):

   SQLRequest(ConnectionStr,QueryText,OutputRef,DriverPrompt,

      ColNamesLogical)

Microsoft provides examples of Visual Basic for applications procedures for

illustration only, without warranty either expressed or implied, including

but not limited to the implied warranties of merchantability and/or fitness

for a particular purpose. This Visual Basic procedure is provided 'as is'

and Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Module Code Example:

   SQLRequest("DSN=NWind;DBQ=c:\msquery;FIL=dBASE4", _

      "Select Custmr_id, Due_date from orders where order_amt > 100", _

      Worksheets("Sheet1").Range("C15"), 2, TRUE)

To use this formula on a worksheet, you must type these lines as one

logical line; do not use the line continuation character.

Worksheet Example:

   =SQLRequest("DSN=NWind;DBQ=c:\msquery;FIL=dBASE4",

      "Select Custmr_id, Due_date from orders where order_amt > 100",

      C15, 2, TRUE)

SQL.REQUEST

-----------

SQL.REQUEST is a worksheet function and an MS Excel 4.0 macro

command. The correct syntax is as follows:

   SQL.REQUEST(connection_string,output_ref,driver_prompt,query_text,

      col_names_logical)

Note that this is the SQL.Request function syntax shown in the

FunctionWizard as well as the syntax shown in the Help file for the

SQLREQUEST function.

NOTE: In Microsoft Excel for Windows 95, verison 7.0, filenames, passwords,

table names, and database names are case sensitive in SQL.REQUEST.

Example:

   =SQL.REQUEST("DSN=NWind;DBQ=c:\msquery;FIL=dBASE4", C15, 2,

      "Select Custmr_ID, Due_Date from Orders WHERE order_Amt>100", TRUE)

NOTE: The connection string and the query text arguments are required

for both the SQLRequest function and the SQL.REQUEST function.

KBCategory: kbprg kbcode

KBSubcategory: xlquery

Additional reference words: 5.00 5.00c 7.00


XL: Maximum Page Number Allowed Is 32767

Article ID: Q117410

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the maximum allowable page number is 32767 and

the minimum allowable page number is -32765.

MORE INFORMATION

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

This limitation is apparent in the following situations:

 - When you change the First Page Number (version 5.0) or the Start

   Page No.'s At (version 4.0) box in Page Setup, the range of

   numbers that may be entered is from -32765 to 32767. Attempting to

   enter a number outside of this range will result in the following error

   message:

      Number is not valid.

 - If your worksheet is using page numbers that are near the upper

   limit, you may notice that the page numbers "wrap around" and become

   negative once the page numbers exceed 32767. The sequence of page

   numbers goes like this:

     32765, 32766, 32767, -32768, -32767, -32766, and so on

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 4.00 4.00a 5.00


XL: Dialog Constants That Do Not Have an Interactive Dialog

Article ID: Q117412

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when a module sheet is selected you can choose Object

Browser from the View menu. To see a list of the built-in Microsoft Excel

dialog box constants, do the following:

1. In a Visual Basic module, choose Object Browser from the Tools menu.

2. From the list of Libraries/Workbooks, select Excel.

3. Under Objects/Modules, select Constants.

All of the built-in constants designed to display dialog boxes begin with

"xlDialog". Some of the constants listed do not have interactive dialog

boxes.

An interactive dialog box is one that allows you to chose options or enter

information. The dialog constants that are included that do not have

interactive dialog boxes are the following:

   xlDialogAppMove

   xlDialogAppSize

   xlDialogErrorbarX

   xlDialogErrorbarY

   xlDialogFormatMove

   xlDialogMove

   xlDialogOpenText

   xlDialogOverlayChartType

   xlDialogPivotFieldUngroup

   xlDialogSaveCopyAs

   xlDialogSetControlValue

   xlDialogSize

   xlDialogSplit

   xlDialogVbaProcedureDefinition

   xlDialogWindowMove

   xlDialogWindowSize

   xlDialogWorkbookTabSplit

REFERENCES

==========

For more information on using Built-in Constants in Microsoft Excel version

5.0 query in the Microsoft Knowledge Base on the following words:

      Constants Built-in Excel WE0993

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: Print Titles Do Not Appear on Every Page of Output

Article ID: Q117799

------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, print titles are printed only after the rows or

columns containing them are printed. For example, if you select a row or

column on the second page of a worksheet to be a print title, the titles

will be printed only on the third and subsequent pages.

Note that this behavior is different from earlier versions of Microsoft

Excel. In earlier versions of Microsoft Excel, print titles appear on every

page of the printed output regardless of their location on the worksheet.

MORE INFORMATION

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

To have a print title appear at the top of every page, position the rows

that contain your print titles in the uppermost rows of your print area.

Likewise, to have a print title appear at the left of every page, you

should have those titles as the leftmost columns of your print area.

Steps to Reproduce Behavior

---------------------------

1. From the File menu, choose New to start a new workbook.

2. In cells A1 through A11, enter the following data:

      A1:  Apples

      A2:  Bananas

      A3:  Carrots

      A4:  Eggplant

      A5:  Food

      A6:  Kudzu

      A7:  Melon

      A8:  Orange

      A9:  Peach

      A10: Raspberry

      A11: Zucchini

3. Click the row heading for row 8, and choose Page Break from the Insert

   menu.

4. From the File menu, choose Page Setup, and select the Sheet tab.

5. In the Rows To Repeat at Top box, type "$5:$5" (without the quotation

   marks), and choose the Print Preview button.

Note that the title "Food" on row 8 appears only at the top of the second

page because it precedes the first row displayed on the second page in

print preview. In earlier versions of Microsoft Excel, the title "Food"

appears at the top of every page.

REFERENCES

==========

For More Information about Print Titles, choose the Search button in

Help and type:

   Print Titles

KBCategory: kbprint

KBSubcategory:

Additional reference words: 5.00 5.00c


XL: Opening Text File Overrides Manual Calculation

Article ID: Q117839

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel version 5.0, if calculation is set to manual,

all open spreadsheets will be recalculated when a text file is

opened. This can cause unnecessary delays if large or complicated

spreadsheets are open.

WORKAROUND

==========

To avoid this problem, close any open sheets that may be recalculated

before you open the text file.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Excel version

5.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

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

When you open a file in Microsoft Excel, if calculation is set to

automatic, open workbooks should be recalculated. If calculation is set to

manual, open workbooks should not be recalculated.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: GP Fault Inserting or Formatting Picture on a Chart

Article ID: Q117848

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you insert a picture on a chart, and you

format the chart series displayed with the picture, you receive a

general protection (GP) fault if you are using the Microsoft Windows

8514/a video driver.

CAUSE

=====

This problem occurs when you insert a .PCX or .BMP graphic image on

your chart. The GP fault occurs while the graphic image is redrawn

on the chart.

WORKAROUND

==========

To avoid receiving a GP fault when you insert a picture on a chart

or format a series on a chart that is represented by a picture, do

either of the following:

 - Use the Microsoft Windows VGA video driver (VGA.DRV) instead of the

   8514/a video driver.

   -or-

 - Insert a .WMF format graphic file in your chart instead of a .BMP file

   or a .PCX format graphic file.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft

products listed at the beginning of this article. This problem was

corrected in Microsoft Excel for Windows 95, version 7.0

REFERENCES

==========

For more information about Creating And Formatting Picture Markers,

choose the Search button in Help and type:

   pictures, replacing data markers with

KBCategory: kbprint

KBSubcategory:

Additional reference words: 5.00 gpf crash hang


XL: Removing the Control Menu and Application Window Controls

Article ID: Q117855

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can create a Visual Basic for applications, macro

to disable or remove the application window and worksheet controls.

MORE INFORMATION

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

You can use the following sample macro in conjunction with workbook

protection, full-screen display, and a custom menu bar to remove the window

controls on a Microsoft Excel workbook. The macro limits a user's ability

to control the window by removing the maximize and minimize buttons and the

window's control menu box, and by disabling the application switching

keystrokes.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Macro Example

-------------

'Macro To Protect the Workbook and Limit User Control

'

Sub WbProtect()

     'Trap for the ALT+F4 (close application) key combination

     Application.OnKey "%{f4}", ""

   ' Note that if you are using Microsoft Excel for Windows 95,

   ' you are unable to override CTRL+ESC, ALT+TAB, and ALT+ESC.

     'Trap for the CTRL+ESC, ALT+TAB and ALT+ESC

     '(application switching) key combinations

     Application.OnKey "^{esc}", ""

     Application.OnKey "%{esc}", ""

     Application.OnKey "%{tab}", ""

     'Turn on error handling in case the Menu bar already exists

     On Error Resume Next

     'Make sure Microsoft Excel is Maximized

     Application.WindowState = xlMaximized

     'Make sure the workbook is maximized

     ActiveWindow.WindowState = xlMaximized

     'Protect the window

     ActiveWorkbook.Protect Structure:=True, Windows:=True

     With ActiveWindow

          .DisplayHorizontalScrollBar = False

          .DisplayVerticalScrollBar = False

          .DisplayWorkbookTabs = False

          .DisplayHeadings = False

     End With

     'Set the application to full screen view

     Application.DisplayFullScreen = True

     'Create a new blank menubar

     MenuBars.Add "mybar"

     'Show the blank menu bar

     MenuBars("mybar").Activate

End Sub

'-------------------------------------------------------------------

'Macro to Restore the Control Menu

'

Sub WbUnprotect()

'Enable the ALT+F4, CTRL+ESC, ALT+ESC, and ALT+TAB keys.

     Application.OnKey "%{f4}"

     Application.OnKey "^{esc}"

     Application.OnKey "%{esc}"

     Application.OnKey "%{tab}"

     On Error Resume Next

     'Restore normal menu if worksheet is active

     MenuBars(xlWorksheet).Activate

     'Restore normal menu if modulesheet is active

     MenuBars(xlModule).Activate

     'Turn off full screen display

     Application.DisplayFullScreen = False

    'Restore window options

    With ActiveWindow

       .DisplayHorizontalScrollBar = True

       .DisplayVerticalScrollBar = True

       .DisplayWorkbookTabs = True

       .DisplayHeadings = True

    End With

     'Unprotect the workbook

     ThisWorkbook.Unprotect

End Sub

REFERENCES

==========

For more information about disabling control menu commands, see the

following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q107689

   TITLE     : XL: Disabling Microsoft Excel Control Menu Commands

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 API protect user Hide


XL: Data Number Formatting Lost Creating Pivot Table

Article ID: Q118371

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you create a pivot table, the formatting of

any numeric values in the table is not retained.

CAUSE

=====

This behavior is by design in Microsoft Excel. The data values used

in a pivot table are not formatted. For example, if you create a

pivot table using the following column of data

   Amount

   $56.00

   $67.00

   $32.00

the values in the pivot table are displayed as follows:

   56

   67

   32

WORKAROUND

==========

To set the formatting for your data when you create a pivot table,

you can format a field that contains numbers in a pivot table either

while you are creating the pivot table or after you create the pivot

table. To do this, use the appropriate procedure below:

While creating the pivot table (in the pivotal Wizard):

1. In the PivotTable Wizard--Step 3 of 4 dialog box, double-click the

   field button of the field that contains the numeric data.

2. In the PivotTable field dialog box, choose the Number button.

3. In the Format Cells dialog box, select the desired number format and

   choose OK. Choose OK to close the PivotTable Field dialog box.

After you create the pivot table:

1. Select a cell in the pivot table that contains one of the numeric field

   values that you want to format.

2. From the Data menu, choose PivotTable field.

3. In the PivotTable field dialog box, choose the Number button.

4. In the Format Cells dialog box, select the desired number format and

   choose OK. Choose OK to close the PivotTable Field dialog box.

Note that this number formatting is not lost when you choose the

Refresh Data command to update the pivot table.

REFERENCES

==========

For more information about Customizing A Pivot Table, choose the

Search button in Help and type:

   pivot tables, customizing

KBCategory: kbtool

KBSubcategory:

Additional reference words: 7.00 5.00 customize custom


XL: Supported Graphic File Formats for Import

Article ID: Q118374

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can import a number of different graphics file

formats. The following is a list of the supported graphic file

formats that you can insert on a chart or worksheet by choosing the

Picture command from the Insert menu.

MORE INFORMATION

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

The Microsoft Excel Setup program gives you the option to install the

following graphic file filters under the Graphics Filters option:

   Windows Metafile (WMFIMP.FLT)

   HP Graphic Language (HPGLIMP.FLT)

   Computer Graphics Metafile (CGMIMP.FLT)

   Encapsulated PostScript (EPSIMP.FLT)

   Tagged Image Format (TIFFIMP.FLT, IFFTIFF.DLL)

   PC Paintbrush (PCXIMP.FLT, IFFPCX.DLL)

These file filters are located in the MSAPPS\GRPHFLT subdirectory of

your Windows directory, along with any other Microsoft shared graphic

filters. If you have installed other Microsoft applications for

Windows, such as Microsoft Word for Windows, you may be able to

import more graphic file formats than are listed above.

REFERENCES

==========

For more information about Inserting A Picture Created By Another

Application, choose the Search button in Help and type:

    pictures, inserting

KBCategory: kbsetup

KBSubcategory:

Additional reference words: 7.00 5.00


XL5 Err Msg: "OLE Automation Error" or "Out of Memory"

Article ID: Q118379

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you run a Visual Basic, Applications Edition,

macro, you may receive one of the following error messages:

   OLE Automation Error

   -or-

   Out of Memory

CAUSE

=====

These error messages typically occur when the macro is referring to a

worksheet object.

MORE INFORMATION

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

Every call between a Visual Basic module and a Microsoft Excel worksheet is

made through Object Linking and Embedding (OLE). When you run a macro, you

usually receive descriptive error messages when OLE errors occur. However,

if OLE encounters an unresolvable error, you may receive one of the error

messages above.

For example, if you run the following Visual Basic macro code, you will

receive an error:

   Msgbox Sheets("Sheet1").Parent

In this example, information is requested from an object instead of from a

property of that object. Since the object doesn't give a property, Visual

Basic tries to return the default property, ".Value." Because worksheets do

not have a Value property, you receive an OLE Automation error.

The correct syntax for the statement above would be:

   Msgbox Sheets("Sheet1").Parent.Name

REFERENCES

==========

"Visual Basic User's Guide," Microsoft Excel 5.0, page 189

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00 value


XL: Macro to Add Labels to Points in an XY (Scatter) Chart

Article ID: Q118485

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, although there is no built-in way to automatically

attach text labels to data points in an xy (scatter) chart, you can create

a macro to do this. This article contains both a Microsoft Excel 4.0 macro

and a Visual Basic macro that you can use to perform this task.

MORE INFORMATION

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

Both of the code examples below assume that your data and associated labels

are arranged on your worksheet in the following format:

 - The first column contains the data labels

 - The second column contains the X values for the X-Y scatter chart

 - The third column contains the Y values for the X-Y scatter chart

Example

-------

   A1: Labels       B1: X Values   C1: Y Values

   A2: DataPoint1   B2: 2          C2: 5

   A3: DataPoint2   B3: 9          C3: 7

   A4: DataPoint3   B4: 5          C4: 3

   A5: DataPoint4   B5: 4          C5: 8

   A6: DataPoint5   B6: 1          C6: 4

Your table should not contain empty columns, and the column containing the

data labels should not be separated from the column containing the x

values. The labels and values must be laid out EXACTLY in the format shown

above (although the upper-left cell does not necessarily need to be cell

A1).

To test these macros, create a chart using the above values and use the

sample macros below.

Microsoft Excel 5.0

-------------------

1. On the worksheet, select the range B1:C6, and press F11.

2. In the ChartWizard - Step 1 of 5 dialog box, click the Next button.

3. In the ChartWizard - Step 2 of 5 dialog box, click XY (Scatter) and then

   click the Next button.

4. In the ChartWizard - Step 3 of 5 dialog box, click the Next button.

5. In the ChartWizard - Step 4 of 5 dialog box, make sure the following

   settings are selected, and then click Finish:

      Data Series in: Columns

      Use First 1 Column(s) for X Data

      Use First 1 Row(s) for Legend Text

Microsoft Excel Version 4.0

---------------------------

1. On the worksheet, select the range B1:C6, and press the F11 key.

2. In the New Chart dialog box, click X-Values for XY-Chart, and then

   click OK.

NOTES:

The following macros will not work when the active chart is currently

embedded in a worksheet; the chart must be in its own window, or on its own

sheet tab (version 5.0 only) when you run the macro.

Also, the following macros will not work if the chart is using "assumed" x

values. To tell if an xy (scatter) chart is using "assumed" x values, do

the following:

   a. Select one of the series in the xy (scatter) chart.

   b. Look at the =SERIES formula in the formula bar. The second item

      (the item following the first comma) inside the parentheses

      refers to the range of x values on the worksheet.

      If this item is blank, then the chart is using "assumed" x values,

      and the macro will not function properly.

Microsoft Excel 4.0 Macro Example

---------------------------------

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided as is and Microsoft in no way guaranties that the

following code can be used in all situations and will not support

modifications of the code to suit specific customer requirements.

This macro will run in both Microsoft Excel version 4.0 and Microsoft Excel

version 5.0.

1. On a new Microsoft Excel 4.0 macro sheet, enter the following code:

   A1:  XLMAttachLabelsToPoints

   A2:  =ECHO(FALSE)

   A3:  ChartName=GET.DOCUMENT(1)

   A4:  xVals=GET.FORMULA("S1")

   A5:  SourceWorksheet=LEFT(xVals,SEARCH("!",xVals,1)-1)

   A6:  SourceWorksheet=RIGHT(SourceWorksheet,LEN(SourceWorksheet)-

           SEARCH("(",SourceWorksheet,1))

   A7:  =IF(LEFT(SourceWorksheet,1)=",")

   A8:  SourceWorksheet=RIGHT(SourceWorksheet,LEN(SourceWorksheet)-1)

   A9:  =END.IF()

   A10: xVals=SUBSTITUTE(xVals,SourceWorksheet,"xlSheet")

   A11: xVals=RIGHT(xVals,LEN(xVals)-SEARCH(",",xVals,1))

   A12: =IF(LEFT(xVals,1)=",")

   A13: =ALERT("This X-Y scatter chart is using assumed X values. The macro

           cannot continue.")

   A14: =HALT()

   A15: =END.IF()

   A16: xVals=LEFT(xVals,SEARCH(",",xVals,1)-1)

   A17: xVals=SUBSTITUTE(xVals,"xlSheet",SourceWorksheet)

   A18: xVals=TEXTREF(xVals)

   A19: Counter=1

   A20: =FOR.CELL("CurrentCell",xVals)

   A21: xLabel=OFFSET(CurrentCell,0,-1,1,1)

   A22: =ATTACH.TEXT(4,1,Counter)

   A23: =SELECT("Text S1P"&Counter)

   A24: =FORMULA(xLabel)

   A25: Counter=Counter+1

   A26: =NEXT()

   A27: =SELECT("")

   A28: =RETURN()

   Explanation of Macro Code

   -------------------------

   A2:       Disables screen updating while the macro runs.

   A3:       Stores the name of the active chart in the name ChartName.

   A4:       Stores the definition of the first series in the chart in the

             name XVals.

   A5-A9:    These lines determine the name of the worksheet from which the

             chart was created and store the name as SourceWorksheet.

   A10:      Substitutes "xlSheet" for the name of the worksheet contained

             in the name XVals. This is done in case the worksheet name

             contains commas (this step allows the commands in A11 and A16

             to function correctly).

   A11, A16: These lines extract the cell range used to create the chart

             ($B$2:$B$6, for example).

   A12-A15:  These lines check to see if the chart is using "assumed"

             X values. If so, an alert message is displayed and the macro

             is terminated. If your data is laid out in the correct manner

             (as shown above), the macro should pass through these lines

             without displaying the alert message.

   A17:      Substitutes SourceWorksheet back into xVals in place of

             "xlSheet".

   A18:      Converts xVals into a proper text reference.

   A19:      Initializes a counter.

   A20:      For each cell in the range xVals (in the example,

             $B$2:$B$6)...

   A21:      Gets the value in the cell to the left of the x-value.

   A22:      Attaches text to the current data point in the chart.

   A23:      Selects the attached text.

   A24:      Puts the text of the label into the attached text.

   A25:      Increments the counter.

   A26:      Continues the loop until all labels have been processed.

   A27:      Makes sure nothing is selected in the chart.

   A28:      Ends the macro.

2. Select cell A1.

3. In Microsoft Excel version 4.0, click Define Name on the Formula menu.

   In Microsoft Excel version 5.0, click Define Name on the Insert menu,

   and then click Define.

4. Click the Command option button.

5. Click OK to accept the change.

The macro is now defined and may be run by clicking Run on the Macro menu

(version 4.0) or clicking Macro on the Tools menu (version 5.0). Make sure

the chart window is active when you run the macro.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

1. In a new module, enter the following code:

   Sub AttachLabelsToPoints()

      ' Dimension variables.

      Dim Counter As Integer, ChartName As Variant

      Dim SourceWorksheet As Variant, xVals As Variant, xCell As Variant

      Dim xLabel As Variant

      ' Disable screen updating while the subroutine runs.

      Application.ScreenUpdating = False

      ' Store the name of the active chart in "ChartName".

      ChartName = ActiveChart.Name

      ' Store the definition of the first series in "xVals".

      xVals = ActiveChart.SeriesCollection(1).Formula

      ' These lines extract the name of the source worksheet from xVals.

      SourceWorksheet = Left(xVals, InStr(1, xVals, "!") - 1)

      SourceWorksheet = Right(SourceWorksheet, Len(SourceWorksheet) - _

        InStr(1, SourceWorksheet, "("))

      If Left(SourceWorksheet, 1) = "," Then

         SourceWorksheet = Right(SourceWorksheet, Len(SourceWorksheet) - 1)

      End If

      ' Replace the actual source worksheet name with "xlSheet" so that the

      ' searches that follow will work correctly if the worksheet name

      ' contains commas.

      xVals = Application.Substitute(xVals, SourceWorksheet, "xlSheet")

      ' More processing of the xVals name.

      xVals = Right(xVals, Len(xVals) - InStr(1, xVals, ","))

      ' If the chart is using "assumed" x-values then show an alert

      ' message

      If Left(xVals, 1) = "," Then

         ' NOTE: the following two lines should be entered

         ' as a single line.

         MsgBox "This X-Y scatter chart is using assumed X values." & _

           " The macro cannot continue."

         ' Exit the subroutine if "assumed" x-values are in use.

         Exit Sub

      End If

      ' More processing of the xVals name.

      xVals = Left(xVals, InStr(1, xVals, ",") - 1)

      ' Put the original source worksheet name back into xVals, replacing

      ' "xlSheet".

      xVals = Application.Substitute(xVals, "xlSheet", SourceWorksheet)

      ' Initialize a counter.

      Counter = 1

      ' For each cell in the range xVals...

      For Each xCell In Range(xVals)

         ' Get the value of the label next to the current x-value.

         xLabel = xCell.Offset(0, -1).Value

         ' Attach a label to the current data point in the chart.

         ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel = _

           True

         ' Put the text ("DataPoint1", for example) into the attached

         ' label.

         ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = _

           xLabel

         ' Increment the counter.

         Counter = Counter + 1

         Next xCell                            'loop until all done

      ' Make sure nothing in the chart is selected.

      Application.ExecuteExcel4Macro "SELECT("""")"

   End Sub

2. Activate the chart sheet.

3. On the Tools menu, click Macro.

4. In the Macro Name/Reference list, click AttachLabelsToPoints, and click

   Run.

Additional reference words: 7.00 4.00 4.00a 5.00 5.00a 5.00c


XL: Macro to Check for Page Breaks on Worksheet

Article ID: Q118589

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can check for an automatic or manual page break in

the current cell by using the PageBreak property in a Visual Basic,

Applications Edition, macro.

MORE INFORMATION

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

The PageBreak property returns or sets the location of a page break using

the Microsoft Excel constants xlNone, xlManual, or xlAutomatic. The

PageBreak property must be applied to an entire row or column (or returned

using an entire row or column as a reference).

VISUAL BASIC CODE EXAMPLES

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Macro To Return Page Break Type For Selected Cell

-------------------------------------------------

You can use the following example to test if there is an automatic page

break above the active cell (horizontal) or next to the active cell

(vertical) on your worksheet. In this example, the macro displays a dialog

box with a message indicating if there is an automatic page break above the

current row.

Sub Check_PageBreak()

   Dim i As Integer, BreakType As Integer

   ' To check for a vertical pagebreak, use the EntireColumn property

   BreakType = ActiveCell.EntireRow.PageBreak

   If BreakType = xlAutomatic Then

      ' Enter the code that you want to run if the current row

      ' contains an automatic page break.

      MsgBox "There is an automatic page break above this row"

   ElseIf BreakType = xlManual Then

      ' Enter the code that you want to run if the current row

      ' contains a manual page break

      MsgBox "There is a manual page break above this row"

   Else

      ' Enter the code that you want to run if the current row

      ' does not contain a page break.

      MsgBox "There is no page break above this row"

   End If

End Sub

Macro To Return Page Breaks For Entire Worksheet

------------------------------------------------

The PageBreak property returns a value indicating what type of page break

exists in the selected range. The PageBreak property does not return the

row or column number that the page break is associated with unless you test

each row on the worksheet. The following macro checks your entire

worksheet, and displays a dialog box with the type of page break and the

number of the row located below the page break.

Sub CheckForPageBreaks()

   Dim TestRow as Range, i as Integer

   Set TestRow=Range("A1")

   For i = 1 to ActiveSheet.Usedrange.Rows.Count

      If rows(i).PageBreak = xlmanual then

         MsgBox "There is a manual page break above row " & i

      ElseIf rows(i).pagebreak = xlautomatic Then

         MsgBox "There is an automatic page break above row " & i

      End If

   Next

End Sub

MORE INFORMATION

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

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q134731

   TITLE     : XL: PageBreak Property Does Not Work as Expected

REFERENCES

==========

For more information about the PageBreak property, choose the Search

button in Visual Basic Help and type:

   PageBreak

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 5.00a 5.00c 7.00 Get.Cell(27)


XL: Problems with Function Wizard and IS Functions

Article ID: Q118849

-------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0

-------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use the Function Wizard with an IS function,

and you refer to a cell reference, the Function Wizard converts the cell

reference to a text string by inserting quotation marks around the

reference.

For example, if you attempt to refer to cell A1, the Function Wizard will

return the following formula:

   =ISERROR("A2")

This behavior will cause the formula to return incorrect results.

CAUSE

=====

This problem occurs with the following IS functions:

   ISBLANK()

   ISERR()

   ISERROR()

   ISEVEN()

   ISLOGICAL()

   ISNA()

   ISNONTEXT()

   ISNUMBER()

   ISODD()

   ISREF()

   ISTEXT()

when the cell being referred to contains an error value, such as #N/A. If

the cell is blank or contains an alphanumeric value, the functions will

work correctly.

WORKAROUND

==========

To work around this problem, enter the formula manually rather than with

the Function Wizard.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Excel version 5.0

for Windows. We are researching this problem and will post new information

here in the Microsoft Knowledge Base as it becomes available.

KBCategory: kbprb

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Submenu Item Appears Enabled with Worksheet Maximized

Article ID: Q118955

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In a Visual Basic procedure in Microsoft Excel, if you use the Enabled

property of the MenuItem object to make a submenu unavailable (dimmed), the

menu item appears available when the worksheet window is maximized.

CAUSE

=====

This behavior occurs if the window of the workbook that contains the

unavailable submenu item is maximized when you choose the submenu item. The

item appears unavailable as expected when the window is restored.

Note that this is not a problem in Microsoft Excel for the Macintosh.

WORKAROUND

==========

To work around this behavior, you must restore the active workbook window

before you choose the submenu item. To restore a workbook window, press

CTRL+F5.

REFERENCES

==========

For more information about the Enabled Property, choose the Search

button in the Visual Basic Reference and type:

    enabled menus, returning

KBCategory: kbprg kbcode

KBSubcategory: xlwin

Additional reference words: 7.00 5.00 5.00c grey gray


XL: Macro Translation Assistant Not Installed

Article ID: Q118956

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

When you install the versions of Microsoft Excel listed at the beginning of

this article, the Macro Translation Assistant file, TRANS.EXE, is not

installed on your computer.

CAUSE

=====

This is by design. The Macro Translation Assistant is not included in these

versions of Microsoft Excel. When you run the Setup program, the Macro

Translation Assistant is not an available option.

For more information about the Macro Translation Assistant, query on the

following words in the Microsoft Knowledge Base:

   macro and translation and assistant and 5.0

KBCategory: kbsetup

KBSubcategory:

Additional reference words: 5.00c mta tools translates lotus 1-2-3

multiplan


GP Fault Using DDEExecute with Multiple Commands

Article ID: Q118974

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

If you use the dynamic data exchange (DDE) Execute statement to send

commands to Microsoft Excel, you receive a general protection (GP) fault if

the Execute statement contains multiple commands.

CAUSE

=====

This problem occurs because there is a limit to the number of commands you

can send in a single DDEExecute statement. In Microsoft Excel version 4.0,

you receive a GP fault if you send more than 127 commands in one DDE

Execute statement. In Microsoft Excel version 5.0, you receive a GP fault

if you send more than 242 commands in a single DDE Execute statement.

In Microsoft Excel version 5.0c, you receive a GP fault if you send more

than 459 commands in a single DDE Execute statement.

In Microsoft Excel for Windows 95, version 7.0, the procedure fails when

195 commands are sent, but you receive a GP fault if you send more than 285

commands.

WORKAROUNDS

===========

To avoid receiving a GP fault when you use the DDE Execute statement, do

not send more than 127 commands to Microsoft Excel in a single Execute

statement. Instead, use multiple Execute statements to send the commands.

For example, to run a macro and open a file in Microsoft Excel using DDE

commands in a Microsoft Word for Windows macro, use the following DDE

Execute commands

   DDEExecute channel, "[RUN(" + Chr$(34) + "MACRO1!R1C1" + Chr$(34) + ")]"

   DDEExecute channel, "[OPEN("+ Q$+ "TEST.XLS"+ Q$+")]"

where channel is the DDE channel number returned by the DDEInitiate

statement.

For additional information, see the following article(s) in the Microsoft

Knowledge Base:

   ARTICLE-ID: Q94713

   TITLE     : Macros to Create DDE Connections Between WinWord and Excel

Kbcategory: kbinterop

KBSubcategory:

Additional reference words: 4.00 4.00a 5.00 gpf err msg officeinterop


XL: Columns Hidden in File Saved to WK1 Format in SuperCalc

Article ID: Q118998

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you open a file that was created in SuperCalc 5,

the cells on the worksheet are not visible.

CAUSE

=====

This behavior occurs in Microsoft Excel because the worksheet columns

are hidden or saved with a column width of zero when you save a file

to the Lotus WK1 file format in SuperCalc 5.

WORKAROUND

==========

When you open a file in Microsoft Excel that was created in SuperCalc

5, do the following to display cells on the worksheet:

1. Select the entire Worksheet by choosing the Select All button (above

   the row number 1) or CTRL+A.

2. From the Format menu, choose Column, and then choose Unhide.

To display gridlines in the file, do the following:

1. From the Tools menu, choose Options.

2. Select the View tab, and under Window Options, select the Gridlines

   check box. Choose OK.

SuperCalc 5 is manufactured by Computer Associates, a vendor independent of

Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

REFERENCES

==========

For more information about Opening A Document Created By Another

Application, choose the Search button in Help and type:

   importing data from other applications, opening imported documents

KBCategory: kb3rdparty

KBSubcategory:

Additional reference words: 7.00 5.00 3rdparty dos 5.5b


Excel: MOD() Function Returns #NUM! Error Value

Article ID: Q119083

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0, 5.0a

----------------------------------------------------------------------

SYMPTOMS

========

The MOD() function in Microsoft Excel may return a #NUM! error value

instead of a valid remainder (modulus).

CAUSE

=====

The #NUM! error will be returned by the MOD() function if the following is

true:

   ('divisor' * 134217728) is less than or equal to 'number'

WORKAROUND

==========

If the above condition is true, and if the MOD() function is returning a

#NUM! error, you can use the following formula to calculate the remainder

(modulus) of two numbers:

   =number-(INT(number/divisor)*divisor)

For example, instead of using this formula

   =MOD(J13,K13)

use this formula:

   =J13-(INT(J13/K13)*K13)

MORE INFORMATION

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

In Microsoft Excel, the MOD() function is used to return the remainder

(modulus) of dividing one number by another. The MOD() function accepts

two arguments:

   Argument   Definition

   --------------------------------------

   Number     The number being divided

   Divisor    The number being divided by

If you want to calculate the remainder (modulus) of 22 divided by 5,

you would use this formula:

   =MOD(22,5)

The result is 2 (22 divided by 5 leaves a remainder of 2).

If the divisor argument, multiplied by 134217728 (or 2 raised to the 27th

power), is less than or equal to the number argument, the MOD() function

will return a #NUM! error value.

KBCategory: kbusage kbprb

KBSubcategory:

Additional reference words: 3.00 4.00 5.00 5.00a 5.00c 7.00


XL: Cell Borders Not Sorted with Data

Article ID: Q119130

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel 5.0, the border formatting of a cell is anchored to that

cell and does not move when you sort a range of cells.

NOTE: This behavior is different from Microsoft Excel 4.0. In Microsoft

Excel 4.0, the border around a cell is anchored to the cell's contents

(that is, when the data is sorted, the border format moves with the cell's

contents).

All other cell formatting, including patterns and locked and hidden

attributes, moves with the value when you sort data in Microsoft Excel 5.0.

WORKAROUND

==========

If you want to create a border-like format that is anchored to the data,

use the drawing tools, and create a line or rectangle around the data.

Then, make sure that the "Cut, Copy, And Sort Objects With Cells" option is

selected on the Edit tab of the Options dialog box (from the Tools menu,

choose Options). When you sort the cells that are outlined with the lines

or rectangles, the objects will be moved with the data in the cells.

STATUS

======

This behavior is by design in Microsoft Excel version 5.0. Cell borders are

often used to delimit portions of the worksheet. And therefore, in order to

maintain the desired spreadsheet format, borders are not moved with the

sorted cells.

REFERENCES

==========

"User's Guide," version 5.0, page 389

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 objects line underline


XL: Custom AutoFilter Won't Filter Numbers Formatted as Text

Article ID: Q119257

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use the Custom AutoFilter dialog box to

filter number values that have been entered as text, and you select

the <> comparison criteria, all of the numbers are displayed, even if

they are equal to the comparison value.

CAUSE

=====

The <> comparison criteria is designed to filter records that are not equal

to the value that you use with the comparison criteria. However, this

criteria does not work to filter number values that are formatted as text.

This behavior affects the following:

 - Numbers in an imported database file when the numbers are contained in a

   column defined as a text field

 - Numbers entered in cells that are formatted as text

 - Numbers preceded by the apostrophe (') character

WORKAROUND

==========

To work around this problem, do either of the following:

 - Enter the numbers first, and then format the numbers as text.

   -or-

 - Use a wildcard character in the comparison value. For example, to filter

   records that are not equal to the value 43, use the comparison criteria

   <>, and the comparison value 43*.

 - When you import data from another application, if the numbers are

   formatted as text, do the following:

   1. In a blank cell on the worksheet that contains the imported data,

      type the number 1.

   2. Select the 1 and choose Copy from the Edit menu.

   3. Select the range of imported numbers.

   4. From the Edit menu, choose Paste Special, and select the Multiply

      option. Choose OK.

REFERENCES

==========

For more information about the Custom AutoFilter Dialog Box, choose

the Search button in Help and type:

   Custom AutoFilter dialog box

KBCategory: kbother

KBSubcategory:

Additional reference words: 5.00


Excel: YIELD Function Incorrectly Returns #NUM! Error Value

Article ID: Q119316

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use the YIELD() function, the #NUM! error

value is returned, even if all of the values that are used in the formula

are correct.

CAUSE

=====

The Newton method, or iterative resolution of equations, is used in

the YIELD() function calculation. It is possible that when you use this

method a solution may not be found, even when a solution does exist.

This error occurs when the maturity date is just greater than one

coupon period away from the settlement date.

For example, if the settlement date is 3/17/93, and the coupon period

is one year (frequency=1), then the error value is returned if the

maturity date is 3/18/94, or one day longer than a coupon period away

from the settlement date.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft

products listed at the beginning of this article. We are researching

this problem and will post new information here in the Microsoft

Knowledge Base as it becomes available.

MORE INFORMATION

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

The YIELD function is available only when you load or open the Analysis

ToolPak add-in file, ANALYSIS.XLL (in Microsoft Excel version 5.0) or

ANALYSF.XLA (Microsoft Excel version 4.0).

REFERENCES

==========

"Standard Securities Calculation Methods, Fixed Income Securities

Formulas," John J. Lynch, Jr.

For more information about YIELD, choose the Search button in Help and

type:

    YIELD function

KBCategory: kbtool

KBSubcategory:

Additional reference words: 7.00 4.00 4.00a 5.00 atp addins


XL: Can't Synchronize Windows By Choosing Arrange All

Article ID: Q119718

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you cannot synchronize windows horizontally or

vertically by choosing Arrange from the Window menu. However, you can

accomplish this by creating a Microsoft Excel or Visual Basic, Applications

Edition, macro.

MORE INFORMATION

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

The following macros assume that a second window for the worksheet has been

opened by choosing New Window from the Window menu.

Visual Basic Macro

------------------

Sub Sync_On()

   'Enables horizontal and vertical window synchronization

   Application.Windows.Arrange arrangestyle:=xlTiled, _

   ActiveWorkbook:=True, synchorizontal:=True, syncvertical:=True

End Sub

Sub Sync_Off()

   'Disables horizontal and vertical window synchronization

   Application.Windows.Arrange arrangestyle:=xlTiled, _

   ActiveWorkbook:=True, synchorizontal:=False, syncvertical:=False

End Sub

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Microsoft Excel 4.0 Macro

-------------------------

Sync_On

'Enables horizontal and vertical window synchronization

=ARRANGE.ALL(1,TRUE,TRUE,TRUE)

=RETURN()

Sync_Off

'Disables horizontal and vertical window synchronization

=ARRANGE.ALL(1,TRUE,FALSE,FALSE)

=RETURN()

KBCategory: kbusage kbcode kbmacro

KBSubcategory:

Additional reference words: 7.00 5.00 sync hsync vsync


XL: Text Import Wizard Maximum Row Limitation of 32767

Article ID: Q119770

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you specify a number in the Start Import At Row box

in the Text Import Wizard, and the beginning row number you specify is a

value greater than 32767, you will receive the following error message:

   Number is not valid.

WORKAROUNDS

===========

To work around this problem, follow the appropriate procedure below.

If your text file has fewer than 49151 rows

-------------------------------------------

 - In the Start Import At Row box of the Text Import Wizard dialog box,

   type "32766" (without the quotation marks).

This workaround will allow the Text Import Wizard to import all data in the

text file from row 32766 to row 49150.

NOTE: The number 49151 is derived from the sum of the 32767-row limitation

and the 16384-maximum number of rows in a worksheet.

-or-

If your text file has over 49150 rows

-------------------------------------

If your text file has over 49150 rows, you will need to create a macro to

import your text file that determines the size of the text file and breaks

it up into individual worksheets of 16384 rows or fewer.

For an example of a Visual Basic, Applications Edition, macro that will do

this, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q120596

   TITLE     : "XL: Importing Text Files Larger Than 16384 Rows"

For an example of a Microsoft Excel Version 4.0 Macro that will do this,

please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q116232

   TITLE     : "Importing Text Files Larger Than 16384 Rows"

MORE INFORMATION

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

When you open a text file in Microsoft Excel, the Text Import Wizard starts

automatically. If a text file has more than 16384 rows of data (the

maximum number of rows that a single Microsoft Excel worksheet can

contain), the Text Import Wizard will allow you to specify a row number for

where in the text file you would like to start importing the data, and the

data will be imported 16384 rows at a time.

KBCategory: kbother

KBSubcategory: kbmacro

Additional reference words: 7.00 5.00 5.00c


XL: Macro to Remove Hidden Names in Active Workbook

Article ID: Q119826

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

Because some macros and add-ins create hidden names on a sheet, links

may exist even after you attempt to remove all known references

(including objects and formulas) from a worksheet. In this situation, when

you open a worksheet containing the hidden links, you may receive the

following error message:

   Update References to Unopened Documents

The macro in the "More Information" section of this article provides a

macro to remove all the hidden names in a workbook.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

Visual Basic Code Example

-------------------------

'Module to remove all hidden names on active workbook

Sub Remove_Hidden_Names()

    'Dimension variables.

    Dim xName As Variant

    Dim Result As Variant

    'Loop once for each name in the workbook.

    For Each xName In ActiveWorkbook.Names

        'If a name is not visible (it is hidden)...

        If xName.Visible = False Then

            '...ask whether or not to delete the name.

            Result = MsgBox(prompt:="Delete hidden name '" & xName.Name &

"'?", Buttons:=vbYesNo)

            'If the result is true, then delete the name.

            If Result = vbYes Then

                xName.Delete

            End If

        End If

    'Loop to the next name.

    Next xName

End Sub

NOTE: If your sheet names contain spaces, you may receive an error when you

attempt to delete the defined name. For more information about this issue,

please see the following article in the Microsoft Knowledge Base:

   XL5: Cannot Use Visual Basic to Delete Names with Spaces

   ID: Q124223

KBCategory: kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


AppNote: "Jet Error Help File (Msjeterr.hlp)" (WE1238)

Article ID: Q119849

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

The Application Note "Jet Error Help File (MSJETERR.HLP)" (WE1238) is now

available from Microsoft Product Support Services (PSS). The WE1238 disk

included with this Application Note contains the Jet Error Help file,

Msjeterr.hlp, for use with Microsoft Excel for Windows 95.

You can obtain this Application Note from the following sources:

 - CompuServe, GEnie, and Microsoft OnLine

 - Microsoft Download Service (MSDL)

 - The Internet (Microsoft anonymous ftp server)

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note" section

at the end of this article.

THE TEXT OF WE1238

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

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

  Microsoft(R) Product Support Services Application Note (TEXT File)

              WE1238: JET ERROR HELP FILE (MSJETERR.HLP)

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

                                                   Revision Date: 9/95

                                                       1 Disk Included

The following information applies to Microsoft Excel for Windows(R)

95, version 7.0.

---------------------------------------------------------------------

 INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY

 ACCOMPANY THIS DOCUMENT (collectively referred to as an Application

 Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER

 EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

 WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR

 PURPOSE. The user assumes the entire risk as to the accuracy and

 the use of this Application Note. This Application Note may be

 copied and distributed subject to the following conditions:  1) All

 text must be copied without modification and all pages must be

 included;  2) If software is included, all files on the disk(s)

 must be copied without modification (the MS-DOS(R)  utility

 diskcopy is appropriate for this purpose);  3) All components of

 this Application Note must be distributed together;  and  4) This

 Application Note may not be distributed for profit.

 Copyright (C) 1995 Microsoft Corporation.  All Rights Reserved.

 Microsoft, MS-DOS, and Windows are registered trademarks of

 Microsoft Corporation.

---------------------------------------------------------------------

Introduction

------------

The WE1238 disk included with this Application Note contains the Jet

Error Help file, Msjeterr.hlp, for use with Microsoft Excel for

Windows 95. Because this Help file is not shipped with Microsoft Excel

for Windows 95, you may receive the following error message when you

use Help while you are using Data Access Objects (DAO) in Microsoft

Excel:

   Cannot find the Msjeterr.hlp file. Do you want to try to find

   this file yourself?

The Msjeterr.hlp file contains information about the error messages

you receive when you use Data Access Objects to manipulate databases

in the native Jet database engine.

To copy the Jet Error Help file to your computer

------------------------------------------------

1. If you received this Application Note on a disk, insert the

   enclosed WE1238 disk in your floppy disk drive.

2. In My Computer or Windows Explorer, double-click the drive that

   contains the enclosed WE1238 disk, or, if you received this file

   electronically, open the folder to which you downloaded the file.

3. Click the Msjeterr.hlp file.

4. On the Edit menu, click Copy.

5. Open the folder to which you installed Microsoft Windows, such as

   C:\Windows. Open the System folder inside your Windows folder.

6. On the Edit menu, click Paste.

The Jet Error Help file is now available on your computer, and the

correct information will appear when you click Help in an error

message that you receive while using DAO objects in Microsoft Excel.

--------------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

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

 - On CompuServe, GEnie, and Microsoft Partner Network (MSPN), Application

   Notes are located in the Microsoft Software Library. You can find WE1238

   in the Software Library by searching on the word WE1238, the Q number of

   this article, or S15535. WE1238.exe is a compressed, self-extracting

   file. After you download WE1238.exe, double-click it to extract the

   contents of the file.

 - Application Notes are available by modem from the Microsoft Download

   Service (MSDL), which you can reach by calling (206) 936-6735. This

   service is available 24 hours a day, 7 days a week. The highest download

   speed available is 14,400 bits per second (bps). For more information

   about using the MSDL, call (800) 936-4100 and follow the prompts. To

   obtain WE1238, download WE1238.exe. WE1238.exe is a compressed, self-

   extracting file. After you download WE1238.exe, double-click it to

   Extract the contents of the file.

 - On the Internet, Application Notes are located on the Microsoft

   anonymous ftp server, which you can reach by typing the following at the

   ">" prompt:

      ftp ftp.microsoft.com

   To download WE1238.EXE, change to the Softlib/Mslfiles directory

   and type the following at the ">" prompt:

      Get WE1238.EXE

 - If you are unable to access the source(s) listed above, you can have

   this Application Note mailed to you by calling Microsoft

   Product Support Services Monday through Friday, 6:00 A.M. to 6:00 P.M.

   Pacific time at (206) 635-7070. If you are outside the United States,

   contact the Microsoft subsidiary for your area. To locate your

   subsidiary, call the Microsoft International Sales Information Center at

   (206) 936-8661.

KBCategory: kbother kberrmsg kbappnote kbfile

KBSubcategory: xlwin

Additional reference words: 7.00 apnote helpfile missing kbfile xl7


Calling a Microsoft Excel Macro from a Lotus 1-2-3 Macro

Article ID: Q119882

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

A macro written for Lotus 1-2-3 may be modified to run a Microsoft

Excel macro in order to perform specific functions. In order to use

the existing Lotus 1-2-3 macro and incorporate the Microsoft Excel

macro, modify the Lotus 1-2-3 macro to include the Lotus 1-2-3 macro

command XLCALL or XLBRANCH.

MORE INFORMATION

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

Two Lotus 1-2-3 macro commands, XLCALL and XLBRANCH allow the you to run a

Microsoft Excel macro from a Lotus 1-2-3 macro. The format of the commands

are {XLCALL xl_macro_name} or {XLBRANCH xl_macro_name}. The XLCALL command

will call the macro (xl_macro_name), then return control to the Lotus 1-2-3

macro that called it. The XLBRANCH command will call the macro

(xl_macro_name) but will not return control to the originating macro.

The {XLCALL} and {XLBRANCH} commands are not available to versions of

Microsoft Excel earlier than version 4.0 because these products did not

use the Microsoft Excel macro interpreter.

For example, if you created a macro named PagePrint to set your headers and

footers on a macro sheet named PRINT.XLM and you want to call the macro

from within one of your 1-2-3 macros, you can do this by inserting the

command {XLCALL PRINT.XLM!PagePrint} within your 1-2-3 macro. Using a

Visual Basic, Applications Edition, macro, the 1-2-3 macro would be written

{XLCALL module1.PagePrint}. As with any subroutine, after the Microsoft

Excel macro runs, control of the macro returns to the 1-2-3 macro. With

XLBRANCH, you branch to Microsoft Excel and do not return to the 1-2-3

macro.

NOTE: A Lotus 1-2-3 macro cannot be run from a Microsoft Excel macro.

Lotus and 1-2-3 are registered trademarks of Lotus Development Corporation.

REFERENCES

==========

"Microsoft Excel Users Guide", version 5.0, page 38

"Switching to Microsoft Excel from Lotus 1-2-3," version 5.0, page 34

KBCategory: kbprg kb3rdparty

KBSubcategory:

Additional reference words: 7.00 4.00 4.00a 5.00 xl5


XL: How to Copy Files from Cabinets on DMF-Formatted Disks

Article ID: Q120006

---------------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0c

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------------

SUMMARY

=======

The files on Disks 2 through 7 of the Setup program for Microsoft Excel

version 5.0c for Windows are stored in cabinet files on DMF-formatted

disks. If you need to copy the files from the disks to a network server or

other permanent storage drive, you must use the copy switch (/C) with the

EXTRACT.EXE utility located on Disk 1 to copy the application files to the

target location.

EXTRACT.EXE allows you to copy the entire cabinet file (*.CAB) or extract

and decompress individual files contained in the cabinet file. You can also

use the EXTRACT utility to search a cabinet file and list its contents.

To obtain a complete list of command options for the EXTRACT, insert Disk 1

and switch to the drive containing the disk. For example, type "A:" without

the quotation marks if the disk is in drive A. Type EXTRACT or EXTRACT /?

at the command prompt to obtain a list of commands for EXTRACT.

MORE INFORMATION

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

A cabinet (*.CAB) file contains many files stored as a single file. The

following are examples that show how to use the EXTRACT command to copy and

extract files from a cabinet file and how to locate the files contained in

a cabinet file.

Copying an Entire *.CAB File

----------------------------

The following examples demonstrate how to use the EXTRACT command to copy

the entire cabinet file to another location.

To copy a cabinet file named EXCEL2.CAB to the current directory, use

the following syntax:

   EXTRACT /C A:\EXCEL2.CAB EXCEL2.CAB

To copy a cabinet file named EXCEL2.CAB to the directory C:\DISK2, use the

following syntax:

   EXTRACT /C A:\EXCEL2.CAB C:\DISK2\EXCEL2.CAB

Copying Files from a *.CAB File

-------------------------------

Below are some examples of how to copy all of the files from a cabinet

file.

To copy all of the files from all cabinets on all disks to the directory

C:\FLAT:

   EXTRACT /E /A /L C:\FLAT A:\EXCEL1.CAB

NOTE: The /A switch extracts all files beginning with the first cabinet, so

Disk 1 should be in drive A when you use EXTRACT with this switch.

To copy all of the files from the EXCEL4.CAB cabinet to the current

directory, use the following syntax:

   EXTRACT /E A:\EXCEL4.CAB

Locating a File in a *.CAB File

-------------------------------

If you need only a single file that is contained in one of the cabinet

files, you can search for it using the /D switch with EXTRACT.EXE. Once you

find the file, you can use EXTRACT.EXE again to copy the file to the

desired location. The following examples show how to use the EXTRACT

command to find files.

To list all files in a cabinet file, use the following syntax:

   EXTRACT /D A:\<cabinet filename>

To list all *.EXE files in a cabinet file, use the following syntax:

   EXTRACT /D A:\<cabinet filename> *.EXE

Copying a Single File from a *.CAB File

---------------------------------------

The following are examples of how to use EXTRACT to copy a single file from

a cabinet file.

To extract ANY.EXE to the current directory, use the following syntax:

   EXTRACT A:\<cabinet filename> ANY.EXE

To extract ANY.EXE to C:\EXCEL, use the following syntax:

   EXTRACT A:\<cabinet filename> /L C:\EXCEL ANY.EXE

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

ARTICLE-ID: Q119838

TITLE     : DMF Information in Office 4.2c Readme Files

KBCategory: kbsetup

KBSubcategory:

Additional reference words: 7.00 1.10 5.00c decomp decompress expand


XL: How to Select Cells/Ranges Using Visual Basic Procedures

Article ID: Q120198

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

When you create a Visual Basic, Applications Edition, procedure, you can

choose from a a variety of methods for selecting cells, ranges, and named

ranges. This article contains sample code that demonstrates some of these

methods.

This article contains the following examples:

 1. How to select a cell on the active worksheet.

 2. How to select a cell on another worksheet in the same workbook.

 3. How to select a cell on a worksheet in a different workbook.

 4. How to select a range of cells on the active worksheet.

 5. How to select a range of cells on another worksheet in the same

    workbook.

 6. How to select a range of cells on a worksheet in a different

    workbook.

 7. How to select a named range on the active worksheet.

 8. How to select a named range on another worksheet in the same

    workbook.

 9. How to select a named range on a worksheet in a different

    workbook.

10. How to select a cell relative to the active cell.

11. How to select a cell relative to another (not the active) cell.

12. How to select a range of cells offset from a specified range.

13. How to select a specified range and resize the selection.

14. How to select a specified range, offset it, and then resize it.

15. How to select the union of two or more specified ranges.

16. How to select the intersection of two or more specified ranges.

17. How to select the last cell of a column of adjacent data.

18. How to select the blank cell at the bottom of a column of

    adjacent data.

19. How to select an entire range of adjacent cells in a column.

20. How to select an entire range of non-adjacent cells in a column.

21. How to select a rectangular range of cells.

Note that these examples do not necessarily represent the best or only way

to perform the described actions. Because of the flexibility in Visual

Basic, there are often many different ways to perform the same action.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided "as is" and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the Visual Basic "User's

Guide."

The examples in this article use the Visual Basic methods listed in the

following table.

   Method             Arguments

   ------------------------------------------

   Activate           none

   Cells              rowIndex, columnIndex

   Application.Goto   reference, scroll

   Offset             rowOffset, columnOffset

   Range              cell1

                      cell1, cell2

   Resize             rowSize, columnSize

   Select             none

   Sheets             index (or sheetName)

   Workbooks          index (or bookName)

   End                direction

   CurrentRegion      none

The examples in this article use the properties in the following table.

   Property         Use

   ---------------------------------------------------------------------

   ActiveSheet      to specify the active sheet

   ActiveWorkbook   to specify the active workbook

   Columns.Count    to count the number of columns in the specified item

   Rows.Count       to count the number of rows in the specified item

   Selection        to refer to the currently selected range

1: How to Select a Cell on the Active Worksheet

-----------------------------------------------

To select cell D5 on the active worksheet, you can use either of the

following examples:

   ActiveSheet.Cells(5, 4).Select

   -or-

   ActiveSheet.Range("D5").Select

2: How to Select a Cell on Another Worksheet in the Same Workbook

-----------------------------------------------------------------

To select cell E6 on another worksheet in the same workbook, you can

use either of the following examples:

   Application.Goto (ActiveWorkbook.Sheets("Sheet2").Cells(6, 5))

   -or-

   Application.Goto (ActiveWorkbook.Sheets("Sheet2").Range("E6"))

Or, you can activate the worksheet, and then use method 1 above to

select the cell:

   Sheets("Sheet2").Activate

   ActiveSheet.Cells(6, 5).Select

3: How to Select a Cell on a Worksheet in a Different Workbook

--------------------------------------------------------------

To select cell F7 on a worksheet in a different workbook, you can use

either of the following examples:

   Application.Goto _

      (Workbooks("BOOK2.XLS").Sheets("Sheet1").Cells(7, 6))

   -or-

   Application.Goto _

      (Workbooks("BOOK2.XLS").Sheets("Sheet1").Range("F7"))

Or, you can activate the worksheet, and then use method 1 above to

select the cell:

   Workbooks("BOOK2.XLS").Sheets("Sheet1").Activate

   ActiveSheet.Cells(7, 6).Select

4: How to Select a Range of Cells on the Active Worksheet

---------------------------------------------------------

To select the range C2:D10 on the active worksheet, you can use any

of the following examples:

   ActiveSheet.Range(Cells(2, 3), Cells(10, 4)).Select

   ActiveSheet.Range("C2:D10").Select

   ActiveSheet.Range("C2", "D10").Select

5: How to Select a Range of Cells on

   Another Worksheet in the Same Workbook

-----------------------------------------

To select the range D3:E11 on another worksheet in the same workbook,

you can use either of the following examples:

   Application.Goto _

      (ActiveWorkbook.Sheets("Sheet3").Range("D3:E11"))

   Application.Goto _

      (ActiveWorkbook.Sheets("Sheet3").Range("D3", "E11"))

Or, you can activate the worksheet, and then use method 4 above to

select the range:

   Sheets("Sheet3").Activate

   ActiveSheet.Range(Cells(3, 4), Cells(11, 5)).Select

6: How to Select a Range of Cells

   on a Worksheet in a Different Workbook

-----------------------------------------

To select the range E4:F12 on a worksheet in a different workbook,

you can use either of the following examples:

   Application.Goto _

      (Workbooks("BOOK2.XLS").Sheets("Sheet1").Range("E4:F12"))

   Application.Goto _

      (Workbooks("BOOK2.XLS").Sheets("Sheet1").Range("E4", "F12"))

Or, you can activate the worksheet, and then use method 4 above to

select the range:

   Workbooks("BOOK2.XLS").Sheets("Sheet1").Activate

   ActiveSheet.Range(Cells(4, 5), Cells(12, 6)).Select

7: How to Select a Named Range on the Active Worksheet

------------------------------------------------------

To select the named range "Test" on the active worksheet, you can use

either of the following examples:

   Range("Test").Select

   Application.Goto ("Test")

8: How to Select a Named Range on

   Another Worksheet in the Same Workbook

-----------------------------------------

To select the named range "Test" on another worksheet in the same

workbook, you can use the following example:

   Application.Goto (Sheets("Sheet1").Range("Test"))

Or, you can activate the worksheet, and then use method 7 above to

select the named range:

   Sheets("Sheet1").Activate

   Range("Test").Select

9: How to Select a Named Range on

   a Worksheet in a Different Workbook

--------------------------------------

To select the named range "Test" on a worksheet in a different

workbook, you can use the following example:

   Application.Goto _

      (Workbooks("BOOK2.XLS").Sheets("Sheet2").Range("Test"))

Or, you can activate the worksheet, and then use method 7 above to

select the named range:

   Workbooks("BOOK2.XLS").Sheets("Sheet2").Activate

   Range("Test").Select

10: How to Select a Cell Relative to the Active Cell

----------------------------------------------------

To select a cell that is five rows below and four columns to the left

of the active cell, you can use the following example:

   ActiveCell.Offset(5, 4).Select

To select a cell that is two rows above and three columns to the right

of the active cell, you can use the following example:

   ActiveCell.Offset(-2, -3).Select

11: How to Select a Cell Relative to Another (Not the Active) Cell

------------------------------------------------------------------

To select a cell that is five rows below and four columns to the

right of cell C7, you can use either of the following examples:

   ActiveSheet.Cells(7, 3).Offset(5, 4).Select

   ActiveSheet.Range("C7").Offset(5, 4).Select

12: How to Select a Range of Cells Offset from a Specified Range

----------------------------------------------------------------

To select a range of cells that is the same size as the named range

"Test" but that is shifted four rows down and three columns to the

right, you can use the following example:

   ActiveSheet.Range("Test").Offset(4, 3).Select

If the named range is on another (not the active) worksheet, activate

that worksheet first, and then select the range using the following

example:

   Sheets("Sheet3").Activate

   ActiveSheet.Range("Test").Offset(4, 3).Select

13: How to Select a Specified Range and Resize the Selection

------------------------------------------------------------

To select the named range "Database" and then extend the selection

by five rows, you can use the following example:

   Range("Database").Select

   Selection.Resize(Selection.Rows.Count + 5, _

      Selection.Columns.Count).Select

14: How to Select a Specified Range, Offset It, and Then Resize It

------------------------------------------------------------------

To select a range four rows below and three columns to the right of

the named range "Database" and include two rows and one column more

than the named range, you can use the following example:

   Range("Database").Select

   Selection.Offset(4, 3).Resize(Selection.Rows.Count + 2, _

      Selection.Columns.Count + 1).Select

15: How to Select the Union of Two or More Specified Ranges

-----------------------------------------------------------

To select the union (that is, the combined area) of the two named

ranges "Test" and "Sample," you can use the following example:

   Application.Union(Range("Test"), Range("Sample")).Select

Note that both ranges must be on the same worksheet for this example

to work.

16: How to Select the Intersection of Two or More Specified Ranges

------------------------------------------------------------------

To select the intersection of the two named ranges "Test" and "Sample,"

you can use the following example:

   Application.Intersect(Range("Test"), Range("Sample")).Select

Note that both ranges must be on the same worksheet for this example

to work.

Examples 17-21 in this article refer to the following example set of data.

Each example states the range of cells in the sample data that would be

selected.

   A1: Name    B1: Sales    C1: Quantity

   A2: a       B2: $10      C2: 5

   A3: b       B3:          C3: 10

   A4: c       B4: $10      C4: 5

   A5:         B5:          C5:

   A6: Total   B6: $20      C6: 20

17. How to Select the Last Cell of a Column of Contiguous Data

--------------------------------------------------------------

To select the last cell in a contiguous column, use the following example:

   ActiveSheet.Range("a1").End(xlDown).Select

When this code is used with the sample table, cell A4 will be selected.

18. How to select the blank cell at the

    bottom of a column of contiguous data

----------------------------------------------------------------

To select the cell below a range of contiguous cells, use the following

example:

   ActiveSheet.Range("a1").End(xlDown).Offset(1,0).Select

When this code is used with the sample table, cell A5 will be selected.

19. How to Select an Entire Range of Contiguous Cells in a Column

-----------------------------------------------------------------

To select a range of contiguous cells in a column, use one of the following

examples:

ActiveSheet.Range("a1", ActiveSheet.Range("a1").End(xlDown)).Select

-or-

ActiveSheet.Range("a1:"&ActiveSheet.Range("a1").End(xlDown).Address).Select

When this code is used with the sample table, cells A1 through A4 will be

selected.

20. How to Select an Entire Range of Non-Contiguous Cells in a Column

---------------------------------------------------------------------

To select a range of cells that are non-contiguous, use one of the

following examples:

   ActiveSheet.Range("a1",ActiveSheet.Range("a16384").End(xlUp)).Select

   -or-

   ActiveSheet.Range("a1:" & ActiveSheet.Range("a16384"). _

      End(xlUp).Address).Select

When this code is used with the sample table, it will select cells "A1"

through "A6."

21. How to select a rectangular range of cells

----------------------------------------------

In order to select a rectangular range of cells around a cell, use the

CurrentRegion method. The range selected by the CurrentRegion method is an

area bounded by any combination of blank rows and blank columns. The

following is an example of how to use the CurrentRegion method:

   ActiveSheet.Range("a1").CurrentRegion.Select

This code will select cells A1 through C4. Other examples to select the

same range of cells are listed below:

   ActiveSheet.Range("a1", _

      ActiveSheet.Range("a1").End(xlDown).End(xlToRight)).Select

   -or-

   ActiveSheet.Range("a1:" & -_

     ActiveSheet.Range("a1").End(xlDown).End(xlToRight).Address).Select

In some instances, you may want to select cells A1 through C6. In this

example, the CurrentRegion method will not work because of the blank line

on Row 5. The following examples will select all of the cells:

   lastCol = ActiveSheet.Range("a1").End(xlToRight).Column

   lastRow = ActiveSheet.Cells(16384, lastCol).End(xlUp).Row

   ActiveSheet.Range("a1", _

      ActiveSheet.Cells(lastRow, lastCol)).Select

    -or-

   lastCol = ActiveSheet.Range("a1").End(xlToRight).Column

   lastRow = ActiveSheet.Cells(16384, lastCol).End(xlUp).Row

   ActiveSheet.Range("a1:" & _

      ActiveSheet.Cells(lastRow, lastCol).Address).Select

NOTES ON THE EXAMPLES

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

 - The ActiveSheet property can usually be omitted, because it is implied

   if a specific sheet is not named. For example, instead of

      ActiveSheet.Range("D5").Select

   you can use:

      Range("D5").Select

 - The ActiveWorkbook property can also usually be omitted. Unless a

   specific workbook is named, the active workbook is implied.

 - When you use the Application.Goto method, you cannot use two cells

   methods within the Range method if the specified range is on

   another (not the active) worksheet. For example, you will receive an

   error message if you use the following example and Sheet1 is not

   the active worksheet:

      Application.Goto _

         (Sheets("Sheet1").Range(Cells(2, 3), Cells(4, 5)))

 - You cannot use the Select method to select a range on any sheet

   other than the active sheet. Instead, you can either use the Activate

   method to activate the correct sheet and then use the Select method,

   or you can use the Application.Goto method to select the range.

 - For any item in quotation marks (for example, the named range "Test"),

   you can also use a variable whose value is a text string. For example,

   instead of

      ActiveWorkbook.Sheets("Sheet1").Activate

   you can use

      ActiveWorkbook.Sheets(myVar).Activate

   where the value of myVar is "Sheet1."

REFERENCES

==========

For more information about any Visual Basic method or property, follow

these steps:

1. From the Help menu in Microsoft Excel version 5.0, choose Contents.

2. Select the "Programming with Visual Basic" topic.

3. Choose the Search button.

4. In the Search box, type the name of the method or property about

   which you want more information, and then choose the Show Topics

   button.

5. Select the topic you want, then choose the Go To button.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 howto contiguous dis-contiguous non-

contiguous nonadjacent non-adjacent


XL: Importing Text Files Larger Than 16384 Rows

Article ID: Q120596

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

Text files that contain more than 16384 rows cannot be opened in their

entirety in Microsoft Excel. You cannot open these files because a

worksheet is limited to 16384 rows. If you open a file that contains more

data than this, the size of the file will produce the following error

message

   File not loaded completely

and the text file will be truncated at the 16384th row. However, you can

use a macro to open the file and automatically break the text into multiple

worksheets.

MORE INFORMATION

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

The following sample macro prompts the user for a text filename, then opens

the file into memory. If the number of rows is larger than the Microsoft

Excel worksheet limit of 16384, the macro breaks the file into multiple

worksheets.

Note that because this is a macro, it may be significantly slower than

choosing the Open command from the File menu.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

'All lines that begin with an apostrophe (') are remarks and are not

'required for the macro to run.

'Name of the Macro

Sub LargeFileImport()

   'Dimension Variables

   Dim ResultStr As String

   Dim FileName As String

   Dim FileNum As Integer

   Dim Counter As Double

   'Ask User for File's Name

   FileName = InputBox("Please enter the Text File's name")

   'Check for no entry

   If FileName = "" Then End

   'Get Next Available File Handle Number

   FileNum = FreeFile()

   'Open Text File For Input

   Open FileName For Input As #FileNum

   'Turn Screen Updating Off

   Application.ScreenUpdating = False

   'Create A New WorkBook With One Worksheet In It

   Workbooks.Add template:=xlWorksheet

   'Set The Counter to 1

   Counter = 1

   'Loop Until the End Of File Is Reached

   Do While Seek(FileNum) <= LOF(FileNum)

      'Display Importing Row Number On Status Bar

       Application.StatusBar = "Importing Row " & _

          Counter & " of text file " & FileName

       'Store One Line Of Text From File To Variable

       Line Input #FileNum, ResultStr

       'Store Variable Data Into Active Cell

       If Left(ResultStr, 1) = "=" Then

          ActiveCell.Value = "'" & ResultStr

       Else

          ActiveCell.Value = ResultStr

       End If

       If ActiveCell.Row = 16384 Then

          'If On The Last Row Then Add A New Sheet

          ActiveWorkbook.Sheets.Add

       Else

          'If Not The Last Row Then Go One Cell Down

          ActiveCell.Offset(1, 0).Select

       End If

       'Increment the Counter By 1

       Counter = Counter + 1

   'Start Again At Top Of 'Do While' Statement

   Loop

   'Close The Open Text File

   Close

   'Remove Message From Status Bar

   Application.StatusBar = False

'End Macro

End Sub

NOTE: The macro does not parse the data into columns. After using the

macro, you may also need to use the Text To Columns command on the

Data menu to parse the data as needed.

When you run this macro on a Macintosh and you are attempting to open a

file residing on the desktop, the filename must be preceded by the

following

   <HardDrive Name>:Desktop Folder:

where <HardDrive Name> is the name of your hard drive, and there is a space

between the words Desktop and Folder.

KBCategory: kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 import ascii


XL5: GP Fault Copying, Moving, or Scrolling Visual Basic Module

Article ID: Q120721

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you copy or move a Visual Basic module, or

when you scroll the module that you moved or copied, you receive a

general protection (GP) fault.

CAUSE

=====

This behavior occurs when the module contains multiple Type statements, and

a ReDim statement that dimensions an array as one of the user defined

types. If you delete one of the Type procedures, and you then copy or move

the module (to another workbook, or to another location in the same

workbook), you receive a GP fault in module VBA.DLL.

The problem occurs when the ReDim statement is compiled again in the new

workbook. The GP fault occurs either immediately after you move or copy the

module (if the ReDim statement is contained in the first screen of the

module) or when you scroll in the module after moving or copying as soon as

the ReDim statement appears on the screen.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows NT, version 5.0.

MORE INFORMATION

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

A user-defined data type is any data type you define using the Type

statement. User-defined data types can contain one or more elements

of any data type, array, or a previously defined user-defined type.

You can use the ReDim statement to declare dynamic-array variables and

allocate or reallocate storage space.

REFERENCES

==========

For more information about the ReDim Statement, choose the Search

button in the Visual Basic Reference and type:

   ReDim

For more information about a User-Defined Data Type, choose the

Search button in the Visual Basic Reference and type:

   Type

KBCategory: kbprg

KBSubcategory:

Additional reference words: 5.00 5.00c gpf 000B:0F15


XL: Overview of ODBC Add-in Functions and Arguments

Article ID: Q120870

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In the versions of Microsoft Excel listed above, the XLODBC.XLA ODBC add-in

provides ODBC functions that allow you to connect to external data sources

directly. XLODBC.XLA provides functions in both the Visual Basic and MS

Excel 4.0 macro languages. All of the functions are macro commands with the

exception of SQL.REQUEST and SqlRequest, which are worksheet functions.

NOTE: The functions SQLBind, SQLClose, SQLError, SQLExec, SQLGetSchema,

SQLOpen, SQLRetrieve, and SQLRetrieveToFile are displayed in the Function

Wizard when the active sheet is a worksheet. However, these functions can

be used only in a macro or module sheet.

MORE INFORMATION

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

The following is a list of the functions provided by XLODBC.XLA and a

description of the arguments for those functions. The arguments for each

function are shown here as they are displayed in the Function Wizard.

Note that there are some discrepancies in the argument naming conventions

used between Function Wizard and the help files.

SQL.BIND(connection_num,column,reference)

SQLBind(ConnectionNum,Column,Reference)

SQL.CLOSE(connection_num)

SQLClose(ConnectionNum)

SQL.ERROR()

SQLError()

SQL.EXEC.QUERY(connection_num,query_text)

SQLExecQuery(ConnectionNum,QueryText)

SQL.GET.SCHEMA(connection_num,type_num,qualifier_text)

SQLGetSchema(ConnectionNum,TypeNum,QualifierText)

SQL.OPEN(connection_string,output_ref,driver_prompt)

SQLOpen(ConnectionStr,OutputRef,DriverPrompt)

*SQL.REQUEST(connection_string,output_ref,driver_prompt,query_text,col_

names_logical)

*SQLRequest(ConnectionStr,QueryText,OutputRef,DriverPrompt,ColNamesLogical)

SQL.RETRIEVE(connection_num,destination_ref,max_columns,max_rows,

col_names_logical,row_nums_logical,named_rng_logical,fetch_first_logical)

SQLRetrieve(ConnectionNum,DestinationRef,MaxColumns,MaxRows,

ColNamesLogical,RowNumsLogical,NamedRngLogical,FetchFirstLogical)

SQL.RETRIEVE.TO.FILE(connection_num,destination,col_names_logical,

column_delimiter)

SQLRetrieveToFile(ConnectionNum,Destination,ColNamesLogical,

ColumnDelimiter)

*The order of the arguments in the MS Excel 4.0 function SQL.REQUEST

differs from that of the Visual Basic function SQLRequest.

NOTE: Although the argument names differ slightly between the Microsoft

Excel 4.0 macro functions and the Visual Basic functions, the arguments

themselves have the same meaning. For example, the argument ConnectionNum

for a Visual Basic function has the same meaning as connection_num for a

Microsoft Excel version 4.0 macro language function.

The following is a description of the arguments used in the above

functions:

Argument             Description

---------------------------------------------------------------------

ColNamesLogical      True if you want column names returned as the

col_names_logical    first row of the results.

Column               The number of the result column to be bound.

column               Result columns are numbered from left to right

                     starting with 1. Column 0 provides row numbers.

                     If you omit column, all bindings for the

                     connection are removed.

ColumnDelimiter      The string to use to separate the elements in

column_delimiter     each row of the created text file. If omitted,

                     a tab is used.

ConnectionNum        The unique ID returned by SQLOpen for the

connection_num       connection made to the data source.

ConnectionStr        Supplies information, such as the data source

connection_string    name, user ID, and password, required by the

                     driver being used to connect to a data source.

                     Must follow the driver's format (see the "References"

                     section of this article for information about

                     where the driver's help file is located). Strings

                     longer than 255 characters must be broken into

                     an array of strings.

Destination          A string that specifies the name and path of

destination          the file where you want to place the results.

                     An existing file will be overwritten.

DestinationRef       A reference specifying the top-left cell where

destination_ref      results should be placed. Any previous values

                     in the destination cells are overwritten

                     without confirmation. If omitted, results are

                     placed according to previous calls to SQLBind.

DriverPrompt         A number specifying if and how the driver should

driver_prompt        prompt for additional needed information for a

                     connection. Refer to the online help for values.

FetchFirstLogical    Important only if MaxRows is specified for

fetch_first_logical  SQLRetrieve, and there are more rows of results

                     than MaxRows available. Use True to return

                     the first set of rows from the beginning of a

                     query's results. Then call SQLRetrieve repeatedly

                     using False to return the next set of rows until

                     all result rows are returned. Refer to the online

                     help for details.

MaxColumns           The maximum number of columns to be returned to

max_columns          the worksheet starting at DestinationRef.

                     If omitted, all columns are returned.

MaxRows              The maximum number of rows to be returned to

max_rows             the worksheet starting at DestinationRef.

                     If omitted, all rows are returned.

NamedRngLogical      True if you want each column of the results to

named_rng_logical    be declared as a named range on the worksheet.

OutputRef            A cell reference where you want the completed

output_ref           connection string placed.

QualifierText        A string that qualifies the information returned

qualifier_text       by TypeNum--only for a TypeNum of 3, 4, or 5.

QueryText            The SQL query to be executed on the data source.

query_text           Strings longer than 255 characters must be broken

                     into an array of strings. While common queries use

                     a standard syntax, there may be differences in

                     driver limitations and extensions (see the

                     "References" section of this article for information

                     about where the driver's help file is located).

Reference            The location of a single cell on a worksheet where

reference            you want the results bound as a Range object.

                     If Reference is omitted, binding is removed for

                     the column.

RowNumsLogical       Used only when destination is included in the

row_nums_logical     function call. If rowNumbers is True, the

                     first column in the result set contains row

                     numbers. If destination is False or omitted,

                     the row numbers are not returned.

TypeNum              Specifies the type of information you want

type_num             returned. Refer to the online help for values.

REFERENCES

==========

For more information about individual functions, see the appropriate help

file. If you are using Windows, the ODBC driver help files are located in

your windows\system directory and are named DRVXXXXX.HLP. If you are using

a Macintosh, the help files for Microsoft ODBC drivers are located in the

Microsoft folder and are called "ODBC SQL Server Help" and "Q+E ODBC FoxPro

Driver Help."

"Microsoft Excel 5.0 User's Guide," Chapter 23.

KBCategory: kbnetwork

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Canceling OnTime Macro When Time Argument Is Volatile

Article ID: Q121212

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Visual Basic, Applications Edition, canceling a recursive OnTime macro

may be difficult when the earliestTime argument is volatile (for example if

you are using the current time).

WORKAROUND

==========

In order to cancel an OnTime method, you must call another OnTime method to

set the schedule argument equal to FALSE. However, note that this method

will not work if the time argument in the OnTime method is set with the NOW

function.

To prepare the first OnTime method so you can cancel it later, create a

time variable and use this variable in both cases, as in the following

example:

     Dim TimeSet as Double

     Sub RunMeFirst()

          TimeSet = Now + TimeValue("00:04:00")

          Application.OnTime TimeSet, "TestMacro"

     End Sub

     Sub TestMacro()

          MsgBox "Hello"

          RunMeFirst

     End Sub

The above macro runs a macro called "TestMacro" four minutes from the

present time. In order to keep this macro from running continuously every

four minutes, use the following syntax either in the same subroutine or

from another:

     Application.OnTime TimeSet, "TestMacro", , False

This procedure works correctly, because the serial value of the variable

"TimeSet" is the same as the serial value used in the first OnTime method.

MORE INFORMATION

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

In order to cancel the first OnTime method, the second OnTime method must

have the same serial number for the time argument as the first OnTime

method. When you use a NOW function for the time argument, such as

   NOW + TimeValue("00:04:00")

Microsoft Excel uses the serial value of NOW + TimeValue("00:04:00"). When

the second OnTime method is issued, the serial value of NOW will have

changed. Because the NOW function is volatile, you cannot exactly duplicate

the earliestTime argument in the second OnTime method.

REFERENCES

==========

For more information about the OnTime function, choose the Search button in

Visual Basic Help and type:

   ontime

KBCategory: kbprg

KBSubcategory: kbcode kbmacro

Additional reference words: 7.00 5.00


XL: Protected File Opens Without Prompt for Password

Article ID: Q121214

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

When you attempt to open a shared password-protected file, and you receive

the following alert message

   File Reservation

   <filename> is being modified by

   <username>

   Open as Read-Only, or choose Notify to be alerted

   when it is available.

A workbook that normally requires a password may not prompt you for a

password.

CAUSE

=====

When you choose Cancel in the error message dialog box, the alert box is

dismissed; however, if you open a file immediately after receiving the

above error message, you will not receive a prompt for a password if the

passwords for the two files are the same.

WORKAROUND

==========

To work around this problem, do either of the following:

 - Save each document with a different password.

   -or-

 - Choose the Read-Only button instead of the Cancel button:

   1. Open the first document as Read-Only instead of choosing the Cancel

      button

   2. Close the first document, and then open the second document.

KBCategory: kberrmsg

KBSubcategory:

Additional reference words: 7.00 5.00 network server share


XL: Can't Use Visual Basic Procedure to Reference Project

Article ID: Q121269

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, you cannot use a Visual Basic procedure to establish a

reference to a project or to an object library. For example, if you turn on

the Macro Recorder, and you use the References dialog box in a Visual Basic

module to establish a reference to a project or an object library, nothing

is recorded.

NOTE: A project is any file that contains a Visual Basic for Applications

module, such as an .XLS or .XLA file.

WORKAROUNDS

===========

To establish a reference in a Visual Basic module to a project, when you

will be copying the module to another computer, do either of the following:

 - In the module that you want to copy to a different computer, use the

   References dialog box (Tools menu) to reference the project before you

   copy the module to a different computer. Then copy the workbook that

   contains this module, and the referenced project to the same directory

   on the second computer. When you use this method, Microsoft Excel finds

   the referenced project and establishes the reference again when you run

   the procedure.

   You can also copy the referenced project to the Microsoft Excel

   directory, the Microsoft Windows directory, the Microsoft Windows SYSTEM

   subdirectory, or any directory that is in the MS-DOS path statement.

   -or-

 - You can call a Visual Basic procedure that is located in another project

   by first opening the project file, and then using the Run method of the

   Application object, and specifying the name of the referenced project

   and the name of the procedure as in the following example:

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose.

   Workbooks.Open("BOOK1.XLS")

   Application.Run "BOOK1.XLS!Macro1"

MORE INFORMATION

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

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q110755

   TITLE     : XL: Deleted Project or Library Listed Twice In References

When you open a Visual Basic module that references a project,

Microsoft Excel searches for the referenced project file in the

following directories:

   1. The directory that contained the project file when you first

      established the reference.

   2. The directory in which the file that contains the reference is

      located.

   3. The directory in which Microsoft Excel is installed.

   4. The directory in which Microsoft Windows is installed.

   5. The SYSTEM subdirectory of the Microsoft Windows directory.

   6. Any directory that is located in the path statement in the

      AUTOEXEC.BAT file.

REFERENCES

==========

For more information about the References Command (Tools Menu),

choose the Search button in Help and type:

   References command (Tools Menu)

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 1.00 5.00 5.00c


XL: Setting Print Area and Print Titles on Worksheet

Article ID: Q121401

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The following information describes different methods that you can

use in Microsoft Excel to set a print title and a print area on your

worksheet.

MORE INFORMATION

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

Page Setup

----------

You can use the Sheet tab of the Page Setup dialog box to set either

a print area or a print title on your worksheet. To display the Page

Setup dialog box, do either of the following:

 - From the File menu, choose Page Setup.

   -or-

 - From the File menu, choose Print, and then choose the Page Setup button.

Note that although you can access the Page Setup dialog box by choosing the

Setup button in Print Preview, you cannot enter a print area or print title

using this method.

Use the following steps to set the print area or print title:

   1. In the Page Setup dialog box, select the Sheet tab.

   2. In the Print Area box, enter the reference of the cells you want to

      use as the print area, such as $A$1:$D$6.

   3. Under Print Titles, in the Rows To Repeat At Top box, enter the

      reference to the row that you want to set as a title, such as $5:$5.

   4. In the Columns To Repeat At Left box, enter the reference to the

      column that you want to set as a title, such as $D:$D.

Note that you can click in the Print Area, Rows To Repeat At Top, or

Columns To Repeat At Left box and select on the worksheet to set the

print area or titles. You can also enter defined names in these

boxes.

Set Print Area Button

---------------------

The Set Print Area dialog box (available by choosing Set Print Area

from the Options menu in version 4.0) is replaced by the Sheet tab in

the Print Setup dialog box in version 5.0. However, you can add the

Set Print Area button to any existing toolbar, or create a custom

toolbar that contains this button. This button allows you to set the

selected cells on your worksheet as the print area.

   1. From the View menu, choose Toolbars.

   2. Choose the Customize button.

   3. From the Categories list, select File.

   4. The Set Print Area button is the fifth button in the first row. Drag

      this button to any displayed toolbar, or to another area to create a

      custom toolbar that contains this button.

To set a print area using this button, select the cells on the

worksheet that you want to set as the print area, and choose the Set

Print Area button.

To clear a print area using this button, select the entire worksheet

using the select all button (at the intersection of the row and

column headings), and choose the Set Print Area button.

Set Print Titles Dialog Box

---------------------------

The Set Print Titles dialog box (available by choosing Set Print

Titles from the Options menu in version 4.0) is replaced by the Sheet

tab in the Print Setup dialog box in version 5.0. However, you can

use the following Visual Basic procedure to display the Set Print

Titles dialog box:

   Sub Set_Print_Titles()

      Application.Dialogs(xlDialogSetPrintTitles).Show

   End Sub

Note that you can assign this procedure to a toolbar button for quick

access.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

File Print Selection

--------------------

You can also print a selection of cells on a worksheet without

setting a specific print area. To use this method, do the following:

   1. Select the cells on the worksheet that you want to print.

   2. From the File menu, choose Print.

   3. Under Print What, select the Selection option and choose OK.

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q109192

   TITLE     : XL5 AppNOTE: Printing Questions and Answers (XE0924)

   ARTICLE-ID: Q105817

   TITLE     : XL: Defined Names for Print Area or Titles May Not Be

               Dynamic

   ARTICLE-ID: Q117799

   TITLE     : XL: Print Titles Do Not Appear on Every Page of Output

   ARTICLE-ID: Q105203

   TITLE     : XL: Print Selection Does Not Ignore Print Titles

   ARTICLE-ID: Q106251

   TITLE     : XL: Print Area and Print Titles Boxes Empty in Print

               Preview

REFERENCES

==========

For more information about the Set Print Area Button or Specifying An

Area Of A Worksheet To Print, choose the Search button in Help and

type:

   print area

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c howto


XL5: Sample Visual Basic Procedure to Print Range of Cells

Article ID: Q121818

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The following Visual Basic Applications Edition procedure lets you print

different parts of a worksheet without first having to select the range of

cells or set the print area in the Page Setup dialog box.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

When you run the following procedure, you are prompted to enter a range of

cells to print. You can enter a name that refers to a range of cells on a

particular sheet or the range itself (for example A1:C15). You may also

specify multiple ranges by separating each range with a comma. Before you

run the macro, the workbook that you want to print from must be the active

workbook.

Sub Print_Area()

  Dim My_Range As String

  On Error Resume Next 'enables error handling

  My_Range = InputBox("Enter the name of the area to print:")

  'if Cancel is chosen then InputBox returns empty string

  If Len(My_Range) > 0 Then Range(My_Range).PrintOut

  If Err > 0 Then MsgBox "Name or range specified is not valid."

End Sub

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, pages 172-178

KBCategory: kbprint kbprg kbcode

KBSubCategory:

Additional reference words: 5.00 5.00c 7.00


EXCEL: How to Create a Column Chart with Two Y Axes

Article ID: Q121819

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0. 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In general, a combination or overlay chart must have a second y axis.

However, when this is done, the column series plotted on the secondary axis

is placed in front of the column series plotted against the primary axis.

In many cases, the overlay series obscures or overlaps the primary series.

MORE INFORMATION

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

To work around this problem, follow the procedure below.

Instead of laying the data out as follows

A1:         B1:   South  C1:  East D1:   North  E1:    Total Sales

A2:   ABC   B2:   10     C2:  5    D2:   12     E2:    27

A3:   DEF   B3:   20     C3:  15   D3:   24     E3:    59

A4:   GHI   B4:   30     C4:  25   D4:   36     E4:    91

A5:   JKL   B5:   40     C5:  35   D5:   48     E5:    123

A6:   XYZ   B6:   50     C6:  45   D6:   60     E6:    155

use the following format:

A1:         B1:   South  C1:  East   D1:  North  E1:   Total Sales

A2:   ABC   B2:   10     C2:  5      D2:  12     E2:

A3:         B3:          C3:         D3:         E3:   27

A4:   DEF   B4:   20     C4:  15     D4:  24     E4:

A5:         B5:          C5:         D5:         E5:   59

A6:   GHI   B6:   30     C6:  25     D6:  36     E6:

A7:         B7:          C7:         D7:         E7:   91

A8:   JKL   B8:   40     C8:  35     D8:  48     E8:

A9:         B9:          C9:         D9:         E9:   123

A10:  XYZ   B10:  50     C10: 45     D10: 60     E10:

A11:        B11:         C11:        D11:        E11:  155

In Microsoft Excel version 5.0

------------------------------

1. Using the second layout, select cells A1:E11. Start the

   ChartWizard, and select Column Chart view 1 in  Step 2.

2. After the chart has been created, double-click the chart to put it in

   edit mode.

3. Select the fourth data series ("Total Sales").

4. From the Format menu, choose Selected Data Series.

5. On the Axis tab, choose Secondary Axis.

The columns will now be displayed appropriately.

To enhance the appearance of the chart further:

1. From the Format menu, choose Chart Type.

2. Then choose the Options button, and then choose the Options tab.

3. Set the Gap Width to a smaller number, so that the last column fills its

   area to match the other series.

In Microsoft Excel version 4.0

------------------------------

1. Using the second data layout, select cells A1:E11. Start the

   ChartWizard, and choose Combination Chart view 2.

2. After a chart has been created, activate the chart window by double-

   clicking it.

3. From the Format menu, choose Overlay.

4. Select Column as the Overlay Chart Type, and set the First Overlay

   Series to 4. Choose OK.

The columns will now be displayed appropriately.

NOTE: To plot an overlay column next to a stacked column, you will want to

stagger the data. This will create data with an overlay series that is

"interleaved," and room will be left for the overlay in the gaps between

the stacked series. This eliminates the overlap that results if you choose

the series as contiguous rows and columns.

To enhance the appearance of the chart further:

1. From the Format menu, choose Overlay.

2. Set the Gap Width to a smaller number, so that the last column fills its

   area to match the other series.

REFERENCES

==========

"User's Guide," version 5.0, pages 265-276, 322-323

"User's Guide 1," version 4.0, pages 428-431

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Custom Function to Express Degree as Fractions of Degrees

Article ID: Q121944

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

Fractions of a degree are commonly expressed in units called minutes and

seconds. One degree is equivalent to 60 minutes, and similarly, one minute

equals 60 seconds. These units are most commonly used for expressing

a navigational point such as a point on a nautical chart.

Although Microsoft Excel lacks a built-in number format to express these

terms, this article contains a sample custom function you can use to

convert a degree value (stored in decimal format, or base 10) to degrees,

minutes, and seconds (stored in text format).

MORE INFORMATION

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

For a similar example using the Excel 4.0 macro language, please see the

following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q73023

   TITLE     : Converting a Decimal Degree Value to Degrees, Minutes,

               Seconds

The following Visual Basic, Applications Edition, custom function will

accept an angle formatted as a decimal value and convert it to a text value

displayed in degrees, minutes, and seconds.

Sample Visual Basic Code

------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code-- comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Function Convert_Degree(Decimal_Deg) As Variant

   With Application

      'Set degree to Integer of Argument Passed

      Degrees = Int(Decimal_Deg)

      'Set minutes to 60 times the number to the right

      'of the decimal for the variable Decimal_Deg

      Minutes = (Decimal_Deg - Degrees) * 60

      'Set seconds to 60 times the number to the right of the

      'decimal for the variable Minute

      Seconds = Format(((Minutes - Int(Minutes)) * 60), "0")

      'Returns the Result of degree conversion

      '(for example, 10.46 = 10~ 27  ' 36")

      Convert_Degree = " " & Degrees & "~ " & Int(Minutes) & "' " _

      & Seconds + Chr(34)

   End With

End Function

To use this function, create a conversion formula, as in the following

example:

   =Convert_Degree(10.46)

This formula will return 10~ 27' 36" (that is, 10 degrees, 27 minutes, 36

seconds).

KBCategory: kbcode kbmacro

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c 5.00a


XL5 Err Msg: GP Fault in Module SDM.DLL

Article ID: Q122059

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

When you run a Microsoft Excel version 4.0 macro (.XLM macro) that calls a

Microsoft Excel version 4.0 dialog box that contains option buttons, you

may receive the following error message:

   EXCEL caused a General Protection Fault in module SDM.DLL at xxxx:xxxx.

where xxxx:xxxx is a memory address.

CAUSE

=====

This error message occurs when, in the dialog box definition table, there

is an invalid type in an option button group section of the table. Note

that option button groups always start with a type value of 11.

Example

-------

The first column of the dialog box definition table contains the following

information:

     11     Option button group

     12     Option button

     45     Invalid table number

     12     Option button

The number 45 is an invalid item type for a dialog box definition table.

Valid number types are from 1 to 24. In this example, a valid number would

be 12, which is an option button.

RESOLUTION

==========

To correct this problem, remove or correct the invalid code in the table.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem has been corrected in

Microsoft Excel for Windows version 5.0c.

KBCategory: kbprg kbmacro

KBSubcategory:

Additional reference words: 7.00 5.00


XL: GP Fault When Info Window Viewed in Print Preview

Article ID: Q122137

----------------------------------------------------------------------

The information in this article applies to:

- Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, you may receive a general protection (GP) fault when

you view the Info window in print preview.

CAUSE

=====

This error will occur if the Info window is set to display the formats

applied to the active cell on the worksheet.

WORKAROUND

==========

To avoid this problem, avoid viewing the Info window in print preview when

Format information is displayed in the window.

To remove the format information from the Info window:

1. Activate the Info window.

2. From the Info menu, choose Format (to remove the check mark that appears

   next to it).

The Info window should no longer contain format information.

KBCategory: kbprb

KBSubcategory:

Additional reference words: 7.00 5.00 GPF


XL: COMPARE.XLA Does Not Work in Microsoft Excel 5.0

Article ID: Q122330

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

Some add-ins that are available in Microsoft Excel version 4.0 are not

included with the versions of Microsoft Excel listed at the beginning of

this article. For example, the COMPARE.XLA add-in

(WORKSHEET COMPARISON in Microsoft Excel for the Macintosh) is not

included in Microsoft Excel 5.0 and later.

If you use the Microsoft Excel version 4.0 COMPARE.XLA add-in in the

versions listed at the beginning of the article, it will not run correctly:

when COMPARE.XLA (or WORKSHEET COMPARISON on the Macintosh) is used in

Microsoft Excel version 5.0, the OK button is unavailable (dimmed) after

you select the sheet to be compared.

This behavior is by design of Microsoft Excel 5.0.

MORE INFORMATION

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

The GET.DOCUMENT() in the versions of Microsoft Excel listed at the

beginning of the article are different from the GET.DOCUMENT() function in

4.0. In Microsoft Excel version 4.0, GET.DOCUMENT(3) returns 5 if the

document is a workbook. In Microsoft Excel version 5.0, GET.DOCUMENT(3)

does not check for a workbook file type because all files in Microsoft

Excel version 5.0 are workbooks. The Type_Num 5 is marked as reserved.

Because of this, the error checking in the add-in does not allow the macro

to proceed.

REFERENCES

==========

For more information about the GET.DOCUMENT() function, choose the search

button in Reference Information Help and type:

   GET.DOCUMENT

"Function Reference," version 4.0, pages 196-199

"User's Guide 2," version 4.0, page 201

KBCategory: kbtool kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 greyed out


Procedure to Export Text File with Comma AND Quote Delimiter

Article ID: Q123183

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, there is no menu command to automatically export

data to a text file so that the text file is exported with quotation

marks AND commas as delimiters. For example, there is no command to

automatically create a text file that contains the following:

   "Text1","Text2","Text3"

You can create this functionality in Microsoft Excel by using a

Visual Basic procedure.

MORE INFORMATION

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

You can use the Print # statement in a Visual Basic procedure similar

to the following to export a text file with quotation marks AND

commas as the delimiters. For the procedure to function properly, you must

select the cells that contain your data before you run it.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

   Sub QuoteCommaExport()

      ' Dimension all variables

      Dim DestFile As String

      Dim FileNum As Integer

      Dim ColumnCount As Integer

      Dim RowCount As Integer

      ' Prompt user for destination filename

      DestFile = InputBox("Enter the destination filename" _

          & Chr(10) & "(with complete path):", "Quote-Comma Exporter")

      ' Obtain next free file handle number

      FileNum = FreeFile()

      ' Turn error checking off

      On Error Resume Next

      ' Attempt to open destination file for output

      Open DestFile For Output As #FileNum

      ' If an error occurs report it and end

      If Err <> 0 Then

         MsgBox "Cannot open filename " & DestFile

         End

      End If

      ' Turn error checking on

      On Error GoTo 0

      ' Loop for each row in selection

      For RowCount = 1 To Selection.Rows.Count

         ' Loop for each column in selection

         For ColumnCount = 1 To Selection.Columns.Count

            ' Write current cell's text to file with quotes

            Print #FileNum, """" & Selection.Cells(RowCount, _

               ColumnCount).Text & """";

            ' Check if cell is in last column

            If ColumnCount = Selection.Columns.Count Then

               ' If so then write a blank line

               Print #FileNum,

            Else

               ' Otherwise write a comma

               Print #FileNum, ",";

            End If

         ' Start next iteration of ColumnCount loop

         Next ColumnCount

      ' Start next iteration of RowCount loop

      Next RowCount

      'Close destination file

      Close #FileNum

   End Sub

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q103985

   TITLE     : Macro to Export Text File with Comma AND Quote Delimiters

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c export quotes commas csv


Excel: Dialog Sheet Control Disabled If an Object Is Behind It

Article ID: Q123187

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0,5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows NT, version 5.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if a control overlaps a drawing object on a dialog

sheet, the control may not be fully enabled.

For example, if you use pictures or shapes for the background design of a

dialog box, and one of the pictures overlaps a button, the button may not

be enabled when you display the dialog box. Depending on how much of the

button overlaps the picture, and depending on the where on the button you

click, the button may or may not perform the expected action.

Note that you can still use the keyboard to choose controls in the dialog

box.

WORKAROUND

==========

To avoid this behavior, make sure that controls that you want enabled

do not overlap drawing objects and pictures on the dialog box.

KBCategory: kbother

KBSubcategory:

Additional reference words: 5.00 5.00c


XL: Header/Footer Margin Settings Not Saved in View Manager

Article ID: Q123192

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use the View Manager add-in to save a view of

your worksheet, the Header and Footer From Edge values are not saved.

CAUSE

=====

This behavior occurs because the Header and Footer From Edge setting is a

new Page Setup setting in Microsoft Excel version 5.0. This setting is not

included as one of the Page Setup settings that is saved by the View

Manager when you create a view.

MORE INFORMATION

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

In Microsoft Excel version 5.0, you can set the distance you want between

the header and the top of the page, and between the footer and the bottom

of the page. You can do this by using the Margins tab in the Page Setup

dialog box, and by entering the desired value under From Edge in the Header

and Footer boxes.

REFERENCES

==========

For more information about the View Manager Command (View Menu),

choose the Search button in Help and type:

   View Manager

KBCategory: kbtool

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c views.xla addins


How to Compute the Average Growth Rate of an Investment

Article ID: Q123198

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 2.x, 3.x, 4.x, 5.0,

   5.0c

 - Microsoft Excel for the Macintosh, versions 2.x, 3.x, 4.x, 5.0,

   5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

-----------------------------------------------------------------------

SUMMARY

=======

The "average growth rate" is a calculation used by financial investors

to determine the best investment over time given present value,

future value, and number of periods per year of an investment. This

calculation can also be referred to as an "annualized yield rate" or

"average rate of return." Note that an annualized rate is always

consistent in that it results in percent-per-year figures.

Microsoft Excel doesn't include an Average Growth Rate Function.

However, you can use the following formula for this calculation

   =((FV/PV)^(1/n))^m-1

where FV is future value, PV is present value, n is the number of

investment periods, and m is the periods per year factor.

MORE INFORMATION

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

Investors want a consistent method to judge investment options. There

are various optional terms given to a method of calculation to

compare these options. One popular term is "average growth rate," and two

others are "annualized yield rate" and "average rate of return."

The most important point is that the method returns consistent unit values.

All results should return an average annual percent-per-year figure. The

results can then be compared directly to determine the best choice of the

options considered. You can calculate this result in Microsoft Excel by

using the common yield formula and adding an average compensation factor.

Method 1: Assume an investment where FV= $120,000, PV=$10,000, n=120

          months, and m=12 months/year.

          AGR = ((120000/10000)^(1/120))^12 - 1   = 0.282089

          AGR = 28.21% per year

Method 2: Assume an investment where FV= $120,000, PV=$10,000, n=10 years,

          and m=1 year/year.

          AGR = ((120000/10000)^(1/10))^1 - 1   = 0.282089

          AGR = 28.21% per year

REFERENCES

==========

"Handbook of Fixed Income Securities," Richard D. Irwin Inc., 1991 pages

79-80

KBCategory: kbother

KBSubcategory:

Additional reference words: howto 7.00 2.00 3.00 4.00 4.00a 5.00 5.00c

Annualized Average Rate Return Yield compound growth rate cumulative growth

rate annual growth rate lotus rate function


XL: Visual Basic Module to Create Gantt Chart

Article ID: Q123260

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can create Gantt Charts that show task status

for project planning and control. The example in this article shows the

steps necessary to generate this type of charts using a Visual Basic,

Applications Edition, procedure.

MORE INFORMATION

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

The following Visual Basic macro creates a Gantt Chart.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

Enter the following in a Visual Basic module:

Sub gantt_chart()

    Dim rge As Variant

    Dim mn As Variant

    Dim shtname As Variant

    'defines the variables

         rge = Selection.Address()

        'get the cell address

        mn = Selection.Offset(1, 1)

        'return the min value for the scale

        Title = InputBox("Please enter the title")

        'Asks the user for title

        shtname = ActiveSheet.Name

        'retains the name of current sheet

        Application.ScreenUpdating=False

        'Turns screen updating off

        Charts.Add

        'Create a paper model chart

        ActiveChart.ChartWizard Source:=Sheets(shtname).Range(rge), _

            Gallery:=xlBar, Format:=3, PlotBy:=xlColumns, CategoryLabels _

            :=1, SeriesLabels:=1, HasLegend:=1, Title:=Title, _

            CategoryTitle:="", ValueTitle:="", _

            ExtraTitle:=""

        ' Basic chart definition

        ActiveChart.Legend.Delete

        'deletes the legend

        ActiveChart.SeriesCollection(1).Select

        'activates series 1

        With Selection.Border

            .Weight = xlThin

            .LineStyle = xlNone

        End With

        'definition for the border for series 1

        Selection.InvertIfNegative = False

        'turns Invert if negative to false

        Selection.Interior.ColorIndex = xlNone

        'indicates that the area is set to none

        ActiveChart.PlotArea.Select

        'select the chart plot area

        ActiveChart.Axes(xlCategory).Select

        'select axis(1)

        With ActiveChart.Axes(xlCategory)

            .ReversePlotOrder = True

            .TickLabelSpacing = 1

            .TickMarkSpacing = 1

            .AxisBetweenCategories = True

        End With

        'axis 1 definition

        ActiveChart.Axes(xlValue).Select

        'select axis(2)

        With ActiveChart.Axes(xlValue)

            .MinimumScale = mn

            .MaximumScaleIsAuto = True

            .MinorUnitIsAuto = True

            .MajorUnitIsAuto = True

            .Crosses = xlAutomatic

            .ReversePlotOrder = False

            .ScaleType = False

            .HasMajorGridlines = True

            .HasMinorGridlines = False

        End With

        ' Axis(2) definition

 End Sub

Example of How to Use The Macro

-------------------------------

1. Open a new worksheet and enter the following values:

     A1:            B1: START        C1: DAYS          D1: DAYS

     A2: TASK       B2: DATE         C2: COMPLETED     D2: REMAINING

     A3: TASK-1     B3: 1/1/91       C3: 150           D3: 15

     A4: TASK-2     B4: 5/1/91       C4: 21            D4: 31

     A5: TASK-3     B5: 7/1/91       C5: 0             D5: 114

     A6: TASK-4     B6: 10/1/91      C6: 0             D6: 4

     A7: TASK-5     B7: 10/15/91     C7: 0             D7: 31

     A8: TASK-6     B8: 11/1/91      C8: 0             D8: 2

2. Select cell A2 and format it with the month/day/year format you  want to

   use on the chart.

3. Highlight A2:D8. To activate the macro, choose Macro from the Tools

   menu, and select the gantt_chart macro.

4. Enter the chart title when prompted.

The Gantt Chart should now be displayed on the screen. Additional

formatting can be added as needed.

REFERENCES

==========

"User s Guide," version 5.0, chapters 15, 17, 18

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: WordBasic Command FileExit Generates An Error

Article ID: Q123327

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Word for Windows, version 6.0

 - Microsoft Word for the Macintosh, version 6.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel version 5.0 for Windows and Macintosh, you will receive

the following error message if you use the WordBasic FileExit command in a

Microsoft Excel macro that performs OLE automation with Word 6.0 for

Windows or Macintosh:

   Run-time error 545:

   The FileExit statement is currently disabled.

CAUSE

=====

OLE Automation cannot invoke the FileExit method of WordBasic. Because OLE

Automation cannot start a new instance of Word after the initial instance,

OLE Automation assumes that you started Word and you are responsible for

exiting the application.

WORKAROUND

==========

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided "as is" and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the Visual Basic "User's

Guide."

To avoid receiving this error message, use the following code to set the

Word object to Nothing rather than using the WordBasic FileExit command:

Sub WordOLE()

Dim Word as Object

   'Create the Word 6.0 object

      Set Word=CreateObject("Word.Basic")

   'Start a new document in Word

   Word.FileNew

   'Insert the text "Some Text" on the new document in Word

   Word.Insert "Some Text"

   'Clear the Word Object

   Set Word = Nothing

End Sub

MORE INFORMATION

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

The CreateObject function will start Word version 6.0 if it is not already

running, otherwise it will use the currently-active instance of Word. The

Set Word = Nothing statement will exit Word if Word was started by the

CreateObject statement.

In Microsoft Word version 6.0 for Macintosh, you can use FileQuit in

place of FileExit. If you use the FileQuit command in a macro that

performs OLE Automation with Word, you will receive the same results.

You will receive the error message "The FileExit statement is currently

disabled" if you use the following code which uses the WordBasic FileExit

command:

Sub WordOLE()

Dim Word as Object

   'Create the Word 6.0 object

      Set Word=CreateObject("Word.Basic")

   'Start a new document in Word

   Word.FileNew

   'Insert the text "Some Text" on the new document in Word

   Word.Insert "Some Text"

   'Attempt to Exit Word

   Word.FileExit

End Sub

REFERENCES

==========

"Visual Basic User's Guide," pages 189-198

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q108043

   TITLE     : How VB Can Use OLE Automation with Word Version 6.0

KBCategory: kbprg kbcode kbinterop

KBSubcategory:

Additional reference words: 5.00 6.00 office applications edition


Excel:  OnEntry Macro to Create a Running Total

Article ID: Q123578

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, to avoid circular references when you create a running

total in a cell, the total must be stored in a non-calculating part of the

worksheet. This result can be achieved through a macro. The macro examples

in the "More Information" section of this article use cell notes to store

totals.

MORE INFORMATION

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

To create a running total in a cell

-----------------------------------

1. Create a macro similar to either of the following code examples (Visual

   Basic or Microsoft Excel 4.0 macro).

2. Save the file and then close it. Re-open the worksheet file that

   contains the Auto_Open macro.

3. Select the cell that you want to contain the running total.

4. Follow the appropriate procedure below to run the SetNote macro.

   If you are using Microsoft Excel version 5.0:

   1. From the Tools menu, choose Macro.

   2. From the Macro Name/Reference, select the macro SetNote, and then

      choose Run.

   If you are using Microsoft Excel version 4.0:

   1. From the Macro menu, choose Run.

   2. Select the SetNote macro, and then choose OK.

To remove a running total

-------------------------

To remove a running total, follow the appropriate procedure below for your

version of Microsoft Excel.

If you are using Microsoft Excel version 5.0:

1. Select the cell on the worksheet that contains the running total.

2. From the Insert menu, choose Note, and then choose Delete.

If you are using Microsoft Excel version 4.0:

1. Select the cell on the worksheet that contains the running total.

2. From the Formula menu, choose Note, and then choose Delete.

After you open the running total macro sheet, you may notice slight pauses

after you enter data into a cell. Each time data is entered in a cell,

Microsoft Excel will run through the RunningTotal Macro. The slight pause

you notice is the time that the computer takes to process the macro

commands.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

' The Auto_Open name forces this macro to run every time

' the workbook containing this macro is opened.

Sub Auto_Open()

'  Every time a cell's value is changed,

'  the RunningTotal macro runs.

   Application.OnEntry = "RunningTotal"

End Sub

' This macro sets up a cell to be a running total cell.

Sub SetNote()

   With ActiveCell

'     Set note to indicate that a running total is present.

'     If the ActiveCell is empty, multiplying by 1 will

'     return a 0.

      .NoteText Text:="RT_" + (ActiveCell * 1)

   End With

End Sub

' This macro runs each time the value of a cell changes.

' It adds the current value of the cell to the value of the

' cell note. Then it stores the new total in the cell note.

Sub RunningTotal()

   With Application.Caller

'     Checks to see if the cell is a running total by

'     checking to see if the first 3 characters of the cell

'     note are "RT_".

      If .NoteText(length:=3) = "RT_" Then

'        Change the cell's value to the new value in the cell

'        plus the old total stored in the cell note.

         .Value = .Value + .NoteText(start:=4)

'        Store the new total in the cell note.

         .NoteText "RT_" + .Value

      End If

   End With

End Sub

Microsoft Excel 4.0 Macro Code Example

--------------------------------------

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose.

After you enter the macros, define Auto_Open, SetNote, and RunningTotal as

command macros that refer to A1, A5, and A9 respectively.

     A1: Auto_Open

     A2: =ON.ENTRY(,"RunningTotal")

     A3: =RETURN()

     A4:

     A5: SetNote

     A6: =NOTE("RT_"&ACTIVE.CELL()*1)

     A7: =RETURN()

     A8:

     A9: RunningTotal

     A10: =IF(GET.NOTE(,,3)="RT_")

     A11: =   FORMULA(CALLER()+GET.NOTE(,4),CALLER())

     A12: =   NOTE("RT_"&CALLER())

     A13: =END.IF()

     A14: =RETURN()

Explanation of macro:

 - Cell A1 defines this cell as Auto_Open which causes this macro to run

   every time the macro sheet is opened.

 - Cell A2 runs the RunningTotal macro every time a cell's value is

   changed.

 - Cell A3 ends the Auto_Open macro.

 - Cell A5 contains the name of the macro that sets up a cell to be a

   running total cell.

 - Cell A6 sets the active cell's note to be "RT_" & the value of  the

   active cell.

 - Cell A7 ends the SetNote macro.

 - Cell A9 contains the macro that runs each time the value of a cell

   changes. It adds the current value of the cell to the value of the cell

   note. Then it stores the new total in the cell note.

 - Cell A10 checks to see if the cell is a running total by checking to see

   if the first 3 characters of the cell note are "RT_".

 - Cell A11 changes the cell's value to the new value in the cell

   and adds the old total stored in the cell note.

 - Cell A12 stores the new total in the cell note.

 - Cell A13 ends the IF() statement.

 - Cell A14 ends the RunningTotal macro.

KBCategory: kbprg kbcode kbmacro

KBSubcategory:

Additional reference words: 7.00 4.00 continuous


XL: Detailed Solutions for Interest Rate Formulas

Article ID: Q123757

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the functions FV, NPER, PMT, PV, and RATE are all

elements of the following two general interest formulas:

If rate is not 0

----------------

PV*((1+ rate)^NPER )+ PMT*(1+rate*type)*(((1+ rate)^NPER)-1)/rate + FV = 0

If rate = 0

-----------

(PMT*NPER)+PV+FV=0

If you look in Help to find detailed information about one of the functions

listed above, these two formulas are referenced. However, Help does not

contain solutions for the individual functions. The information in the

"More Information" section of this article contains solutions for each of

these functions.

MORE INFORMATION

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

For each function below, a definitions is given, and then general solutions

are provided with the special case of rate=0 solutions given last. The

solutions are in alphabetical order by derived function name.

Note: All of the general terms are shown as positive, but the actual value

will be positive (receiving) or negative (paying) cashflow. Input variables

must always be entered with the appropriate sign.

Definitions

-----------

FV   - Future value of the investment

NPER - Number of periods in the investment

PMT  - Payment amount of the investment

PV   - Present value of the investment

rate - Interest rate of the investment

type - 0 if payment is at the end of a period,

       1 if payment is at the start

Formulas If Rate Is Not 0

-------------------------

FV   = (PMT*(1+rate*type)*(1-(1+ rate)^NPER)/rate)-PV*(1+rate)^NPER

NPER = LOG10((PMT*(1+rate*type)-FV*rate)/(PMT*(1+rate*type)+PV*rate))/

       LOG10(1+rate)

PMT  = (rate*(FV+PV*(1+ rate)^NPER ))/((1+rate*type)*(1-(1+ rate)^NPER))

PV   = (PMT*(1+rate*type)*(1-(1+ rate)^NPER)- rate*FV)/(rate*(1+rate)^NPER)

rate = Must be solved using iterative processes since it is an equation of

       variable order depending on the value of NPER.

Formulas If Rate Is 0

---------------------

FV   = -1(PV+PMT*NPER)

NPER = -1(FV+PV)/PMT

PMT  = -1(FV+PV)/NPER

PV   = -1(FV+PMT*NPER)

These solutions are a derivation of the model. If you test the solutions

against the actual functions in Microsoft Excel, be sure the terms are not

forced to integer at any point, because rounding errors become more

significant as the order of the equation increases. (If you test the

function programmatically, define the terms as type double to reduce

computation errors).

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00


XL5: Error Returning Formula with Long Sheet and Filename

Article ID: Q123762

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows NT, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if a formula on your worksheet refers to a cell

in another workbook, and the combined number of characters in the

reference to this cell (combination of worksheet and workbook name)

is greater than 108 characters, you may not be able to return the

formula in this cell using a macro.

If you use the GET.CELL(6) function in a version 4.0 macro to return

the formula in this cell, the #VALUE error value is returned.

If you use the Formula property in a Visual Basic procedure to return

the formula in this cell, you receive Error 2015 in the Debug window,

or the following error when you run the procedure:

   'Run-time error 13:'

   Type Mismatch

Additionally, if you use the MsgBox function to display the Formula

property for this cell, you receive a "type mismatch" error message.

If you set the Formula property for this cell equal to a variable,

error 2105 is returned to the variable.

CAUSE

=====

In Microsoft Excel for Windows NT, you can create filenames with up to 255

characters. However, when you reference a cell on another worksheet in

Microsoft Excel, if the sum of the number of characters in the worksheet

name and twice the number of characters in the workbook name is greater

than 247, you cannot use a macro to return the formula that contains this

cell reference.

For example, if the workbook name contains 124 characters, and the

worksheet name contains 6 characters, you cannot return the formula

that contains this cell reference on this worksheet (2*124+6=254).

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows 95, version 7.0.

REFERENCES

==========

For more information about GET.CELL, choose Contents from the Help menu,

choose the Reference Information Help topic, and then choose the Microsoft

Excel Macro Function Contents. In the Microsoft Excel Macro Functions Help

dialog box, choose the Search button and type:

   GET.CELL function

KBCategory: kbprg

KBSubcategory: xlnt

Additional reference words: 5.00


XL: 5.0c Allows You To Choose Recording Method Before Recording

Article ID: Q124092

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

In the versions of Microsoft Excel listed at the beginning of this article,

you can choose how references are handled in recorded macros (that is,

whether they are recorded as absolute or relative references) BEFORE you

start the recording session. This behavior is different from earlier

versions of Microsoft Excel (including version 5.0.)

In versions of Microsoft Excel earlier than 5.0c, you must start recording

the macro before you are able to specify absolute or relative references.

(Note, however, that even though this step is performed after you begin

recording, it is not recorded in the macro.)

In the versions of Microsoft Excel listed at the beginning of this article,

to specify absolute or relative references, choose Record Macro from the

Tools menu. If you want to use relative references, choose the Use Relative

References command (when this option is active, a check mark will appear

next to it).

REFERENCES

==========

For more information about recording macros, choose the Search button in

Help and type:

   recording macros

KBCategory: kbprg kbusage

KBSubcategory:

Additional reference words: 7.00 5.00


XL: OLE Automation Example: Controlling MS Excel from VB

Article ID: Q124094

-----------------------------------------------------------------------

The information in this article applies to:

- Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

- Microsoft Visual Basic version 3.0, Standard or Professional Editions

-----------------------------------------------------------------------

SUMMARY

=======

With Microsoft Visual Basic version 3.0 and OLE Automation, you can use

Microsoft Excel Visual Basic, Applications Edition, commands from within a

Visual Basic 3.0 procedure.

MORE INFORMATION

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

The following code is an example of how to send commands to Microsoft Excel

5.0 to create a 3D column chart from new information, rotate the chart, and

close Microsoft Excel.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Sub Command1_Click ()

    Dim ExcelApp As Object

    Dim ExcelChart As Object

    Dim CharTypeVal As Integer

    Dim i as Integer

    '-4100 is the value for the Excel constant xl3DColumn. Visual

    'Basic does not understand Excel constants, so the value must be

    'used instead.

    ChartTypeVal = -4100

    'Creates OLE object to Excel

    Set ExcelApp = CreateObject("excel.application")

    'Sending VB Applications Edition commands to Excel via the new OLE

    'object to create a new workbook fill in numbers, create the chart, and

    'rotate the chart.

    ExcelApp.Visible = True

    ExcelApp.Workbooks.Add

    ExcelApp.Range("a1").Value = 3

    ExcelApp.Range("a2").Value = 2

    ExcelApp.Range("a3").Value = 1

    ExcelApp.Range("a1:a3").Select

    Set ExcelChart = ExcelApp.Charts.Add()

    ExcelChart.Type = ChartTypeVal

    For i = 30 To 180 Step 10

        ExcelChart.Rotation = i

    Next

    'Must use square brackets around the Close method of the Workbook

    'object because Close is also a reserved word in Visual Basic.

    'Using the square brackets tells Visual Basic that this is an

    'Excel command not a Visual Basic one.

    ExcelApp.ActiveWorkbook.[Close](False)

    ExcelApp.Quit

    Set ExcelChart = Nothing

    Set ExcelApp = Nothing

    End

End Sub

To use this subroutine, create a form in Visual Basic and add a single

button to that form. Double-click the button and type the code shown above

in the procedure window. Close the procedure window, and choose Start from

the Run menu. To see the rotating chart, click on the button in your form.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Inserting a Vertical Line in Microsoft Excel Chart

Article ID: Q124112

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can add a vertical line to a chart such that the

line has a mathematical relationship to the data on your chart. You can

use this line to show the dividing point between historical data and

projected data.

To create this line, follow the procedure in the "More Information"

section of this article.

NOTE: This feature is not available in earlier versions of Microsoft Excel

5.0.

MORE INFORMATION

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

1. Enter the following sample data in a new Microsoft Excel worksheet.

   Sample Data

   -----------

   A1: a   B1: 1

   A2: B   B2: 2

   A3: c   B3: 3

   A4: d   B4: 4

   A5: e   B5: 5

   A6: 1.5 B6: =CEILING(MAX(B1:B5),1)

   A7: 1.5 B7: =IF((MIN(B1:B5)>0)*(MIN(B1:B5)<=1),0,MIN(B1:B5))

    NOTE: The formula in cell B6 sets the maximum to the round up value of

    the maximum of your data. The formula in cell B7 will set the minimum

    value of the vertical line equal to zero if the minimum value of your

    data series (B1:B5) is less than or equal to 1 and greater than 0.

2. Select cells A1:B5, and choose the ChartWizard tool.

3. With the ChartWizard tool active, select a location for the chart, and

   then choose Finish.

4. Select cells A6:B7, and choose Copy from the Edit menu.

5. Select the chart object, and choose Paste Special from the Edit menu.

6. In the Paste Special dialog box, select the following options

    - Under Add Cells As, select New Series

    - Under Values (Y), select Columns

   and select the "Categories (X Labels) In First Column" check box.

7. Activate the Chart Object, select the new column, and choose Chart Type

   from the Format menu. In the Chart Type dialog box, select the following

   options and choose OK:

    - Under Apply to, select Selected Series

    - Select the XY (Scatter) chart type

8. With the new series selected, choose Selected Data Series from the

   Format menu, select the Patterns tab, and select the following options:

    - Under line, select Custom

    - Under Marker, select None

To adjust where the line is plotted, change the numbers in cells A6:A7.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 5.00


XL5 Err Msg: "File Format No Longer Supported" Creating Add-in

Article ID: Q124180

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you create an add-in, you may receive the

following error message:

   File format no longer supported

When you choose OK, you receive the following error message:

   Document not saved

CAUSE

=====

This behavior occurs when you create an add-in with the same name as an

existing add-in and you choose to overwrite the existing add-in while a

module that references this add-in is open. For example, if you reference

BOOK1.XLA in a module in BOOK2.XLS, you cannot create a new add-in called

BOOK1.XLA while BOOK2.XLS is open.

Note that this behavior occurs only if the add-in that you are creating

contains different information than the existing add-in, even if it is just

a modified version of the existing add-in. Because you cannot open an add-

in for editing, creating an add-in with the same name as an existing add-in

is the only way to "modify" the add-in.

If you open an add-in file either by using the Open command, or by

using a Visual Basic procedure, and you then use the Make Add-In

command to create an add-in with the same name as the open add-in,

you receive the following error message:

   Cannot save this file with the same name as an open document

To stop this error message from being displayed, close Microsoft Excel.

WORKAROUND

==========

To avoid receiving this error message when you create an add-in file,

close any workbooks that contain a module that references the add-in

that you are creating.

MORE INFORMATION

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

In Microsoft Excel versions 5.0 and 5.0c, you cannot open an add-in

for editing. When you open an add-in file while holding down the SHIFT

key, you receive the following error message:

   Cannot open Microsoft Excel 5.0 Add-In for editing. Please edit the

   source document instead.

After you edit the source document, you can use the Make Add-In

command (Tools menu) to update the add-in file with your changes.

However, if a module that references the add-in is open, you receive

the error messages described above.

REFERENCES

==========

For more information about the Make Add-in Command (Tools Menu),

choose the Search button in Help and type:

   add-ins

KBCategory: kbprg kberrmsg

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c addins


XL5 Err Msg: Columns (or Rows) Method of Range Class Failed

Article ID: Q124220

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows NT, version 5.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run a Visual Basic for applications macro in Microsoft Excel,

if the macro uses the Columns or the Rows method of the Range class, you

may receive either of the following error messages:

   Run-time error '1004':

   Columns Method of Range Class Failed

   -or-

   Run-time error '1004':

   Rows Method of Range Class Failed

CAUSE

=====

If the argument passed to the Columns method has a value less than 1, you

will receive the above error message. For example, if you run the following

sample code, you will receive the error message.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Sample Visual Basic Code

------------------------

Sub Test()

   'Passing a value of zero to the Columns method will result in an error

   Selection.Columns(0).Select

End Sub

WORKAROUNDS

===========

Although you cannot use a value less than 1 with the Columns method, you

can refer to a specific column with the Offset and Resize methods. To do

this, use either of the following methods.

Method 1: To change the current selection to that of a single column of

          cells that has the same number of rows as the previous selection

          (in this case two columns to the left of the left-most column in

          the previous selection), use the following code:

             Selection.Offset(0, -2).Resize(Selection.Rows.Count, 1).Select

          NOTE: To do this with the Columns method, the syntax would be

          Selection.Columns(-1).Select (but using -1 with Columns causes

          the error message described above).

Method 2: To change the selection C1:C4 to the range B1:B4, use the

          following code:

             Range("C1:C4").Offset(0,-1).Select

          NOTE: To do this with the Columns method, the syntax would be

          Range("C1:C4").Columns(0).Select (but using 0 with Columns

          causes the error message described above). Note that the second

          argument of the Offset method (-1) is one less than the argument

          used in the Columns method example (0). Note also that you do not

          need to use the Resize method, because the original range (C1:C4)

          is only one column wide.

STATUS

======

Microsoft has confirmed this to be a problem in the versions of Microsoft

Excel listed at the beginning of this article. We are researching this

problem and will post new information here in the Microsoft Knowledge Base

as it becomes available.

MORE INFORMATION

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

You can use an argument with a value of less than one (1) with the Rows

method. Using this value has the effect of referring to a range that is

above the range object that is referred to by the Rows method, as in the

following example:

   Range("A2:C2").Rows(0).Select

The above statement causes the current selection to be changed from A2:C2

to A1:C1.

Also note that you WILL receive an error if you use the Rows or Columns

methods to create a reference that does not exist, as in the following

examples:

   Range("A1").Rows(0).Select

   -or-

   Cells(1,256).Columns(2).Select

The above statements generate errors because the resulting references are

not valid references in Microsoft Excel (the first example is one row above

cell A1 and the second example refers to a cell in column 257--neither of

these references exist in Microsoft Excel).

REFERENCES

===========

For more information about Rows or Columns Method, click the Index tab in

Microsoft Excel 7.0 Help, type the following text

   Rows Method

   -or-

   Columns Method

and then double-click the selected text to go to the "Rows Method" or the

"Columns Method" topic.

For more information on the Columns method, choose Contents from the Help

menu in Microsoft Excel 5.0, click the Programming With Visual Basic topic,

click the Search button, and type the following text:

   Columns Method

KBCategory: kbprb kberrmsg

KBSubcategory:

Additional reference words: columns method fail failed 5.00 5.00c


XL: Using AutoSum in a Visual Basic Macro

Article ID: Q124222

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

In Visual Basic, Applications Edition, there is no function to emulate the

behavior of the AutoSum tool. However, you can activate this tool from a

module by using the SendKeys method to send the keyboard shortcut to start

the AutoSum tool, or you can create a macro that sums a contiguous column

of numbers. For examples of these procedures, see the sample Visual Basic

code in the "More Information" section of this article.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Sample Visual Basic Macro 1

---------------------------

The following Visual Basic macro activates the AutoSum function in the

active cell:

Sub SumRange()

   Application.SendKeys "%="   'sends the key combination ALT+=

   Application.SendKeys "~"    'sends the enter key

End Sub

Sample Visual Basic Macro 2

---------------------------

' Auto_Sum Macro

'

' This function sums a contiguous column of numbers

' and assumes that the insertion point is located in the cell

' in which you want the sum formula to appear.

'

Sub Auto_Sum()

   ' Dimension variables

   Dim L As Integer, i As Variant

   Dim start_cell As String, end_cell As String

   L = 0

   ' Look for the first numeric value in either the preceding

   ' cells in the column that contains the active cell or the

   ' preceding cells in the row that contains the active cell

   Call search_proc(i, L)

   ' Check to see if a value has been found in a row or column

   If L = 1 Then

      ' if a value has been found in a preceding column, assign the

      ' first cell to start_cell

      start_cell = _

        ActiveCell.Offset(0, -i).Address(ReferenceStyle:=xlR1C1) & ":"

      ' search for the last value of the contiguous range

      ' of values in the given column

      For i = i To ActiveCell.Column - 1

         If Trim(ActiveCell.Offset(0, -i).Value) = "" Then

            end_cell = _

              ActiveCell.Offset(0, 1 - i).Address(ReferenceStyle:=xlR1C1)

            Exit For

         ElseIf i = ActiveCell.Row - 1 Then

            ' The following two lines must be entered as one line of code

            end_cell = ActiveCell.Offset(0, 1 -

              ActiveCell.Column).Address(ReferenceStyle:=xlR1C1)

         End If

      Next i

   ElseIf L = 2 Then

   ' If the value was found in a preceding row, assign start_cell

   ' to the appropriate value

   start_cell = _

     ActiveCell.Offset(-i).Address(ReferenceStyle:=xlR1C1) & ":"

   For i = i To ActiveCell.Row - 1

      If Trim(ActiveCell.Offset(-i).Value) = "" Then

         end_cell = _

           ActiveCell.Offset(1 - i).Address(ReferenceStyle:=xlR1C1)

         Exit For

      ElseIf i = ActiveCell.Row - 1 Then

         ' the following two lines must be entered as one line of code

         end_cell = ActiveCell.Offset(1 -

           ActiveCell.Row).Address(ReferenceStyle:=xlR1C1)

      End If

   Next i

   Else

   ' if no values are found in the search, set the

   ' variables to be empty and place the keystrokes

   ' in the keyboard buffer to do the sum

      start_cell = ""

      Application.SendKeys "=SUM+9+0"

   End If

   ' The {F2} key will put Excel in Edit mode

   Application.SendKeys "{F2}"

   If start_cell = "" Then

      ' If no start_cell is found, the cursor will have to be placed

      ' in the appropriate position

      Application.SendKeys "{LEFT}"

   Else

      ' If both a start cell and an end cell are found, use those

      ' addresses to form the SUM function

      ActiveCell.FormulaR1C1 = "=SUM(" & start_cell & end_cell & ")"

      ' This function changes the referencing in the cell

      ' from absolute to relative

      ActiveCell.Replace what:="$", replacement:=""

   End If

End Sub

   ' The following procedure searches for cells

   ' to be used in the sumation

   Sub Search_Proc(i, L)

   ' First search the cells of the column

   For i = 1 To ActiveCell.Row - 1

      ' Check to see if the cell's length is greater than 0 and it

      ' has a numeric value

      If Len(Trim(ActiveCell.Offset(-i).Value)) > 0 And _

        IsNumeric(Val(Trim(ActiveCell.Offset(-i).Value))) Then

         ' if the cell's contents pass the test, then flag the

         ' direction that it was found in and preserve the vector

         L = 2

         Exit For

      End If

   Next i

      ' If cells containing values were not found in the column,

      ' check cells to the left

      If L = 0 Then

         For i = 1 To ActiveCell.Column - 1

            ' check if the cells have data in them and

            ' whether the data is numeric

            If Len(Trim(ActiveCell.Offset(0, -i).Value)) > 0 And _

              IsNumeric(Val(Trim(ActiveCell.Offset(0, -i).Value))) Then

               ' if data is found and it is numeric, flag the

               ' direction and exit the loop

               L = 1

               Exit For

            End If

         Next i

      End If

   End Sub

For additional information, please see the following article in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q103164

   TITLE     : Excel: How to Use AutoSum in a Macro

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 5.00c 7.00


Public and Module-Level Variables Lost with SaveAs Method

Article ID: Q124224

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you create a Visual Basic, Applications Edition

macro, and you apply the SaveAs method to the workbook in which the code is

currently running, you may lose the values for the public and module-level

variables.

CAUSE

=====

If the workbook is saved with a name that is different from the workbook's

present name, the variables are  reinitialized (they will not represent

values).

STATUS

======

Microsoft has confirmed this to be a problem with Microsoft Excel versions

listed above. We are researching this problem and will post new information

here in the Microsoft Knowledge Base as it becomes available.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00a 5.00c scope static


Error '1004' When Using the SQLRequest Macro Function

Article ID: Q124226

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In the versions of Microsoft Excel listed above, you may receive the

following error message when you use the SQLRequest function in a Visual

Basic, Applications Edition, macro:

   Run-time error '1004':

   Run method of Application class failed

This error message will occur if the SQLRequest function returns a

result set containing more than 4095 elements.

CAUSE

=====

The SQLRequest function has an argument called ColNamesLogical, which

specifies whether to return field headings. If this argument is set to

TRUE, then in the case above you can only return up to 4094 elements or

cells and 1 field heading. If ColNamesLogical is set to FALSE or is

omitted, then you can return only 4095 records.

RESOLUTION

==========

To return a result set with more than 4095 elements, use the SQLRetrieve

function as it's used in the following sample procedure:

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Sample Visual Basic Procedure

-----------------------------

This procedure opens a channel to a given data source, executes a query,

retrieves the result set to the active cell on the active worksheet, and

closes the channel opened by SQLOpen:

   Sub GetMyData()

       chan = SQLOpen("DSN=Nwind")

       ' Get all columns and records from the orders table.

       SQLExecQuery chan, "SELECT * FROM orders"

       ' Retrieve the results from SQLExecQuery to the active cell

       ' and include the field headings.

       SQLRetrieve chan, ActiveCell, , , True

       SQLClose chan

   End Sub

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

REFERENCES

==========

For more information on the SQLRequest and SQLRetrieve functions choose the

Search button in Visual Basic Reference Help and type:

   SQLRequest

   -or-

   SQLRetrieve.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL5 Err Msg: "Can't Find Project or Library" Running Macro

Article ID: Q124277

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel 5.0, you may receive the following error message

when you attempt to run a Visual Basic macro:

   Can't Find Project or Library

RESOLUTION

==========

To correct the referencing problem, follow these steps:

1. In the References dialog box, choose Browse.

2. Select the correct path and name of the file you want to

   reference and press OK.

   The new file name, with the correct path shown at the bottom, should

   appear in the References dialog box.

3. Choose OK and save the file.

You should be able to run the macro once the references have been set to

the correct files.

MORE INFORMATION

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

In Microsoft Excel version 5.0, in order to use external or custom

functions from another library or workbook, you must establish a

reference to the file through the References option on the Tools

menu. The References option allows you to add, delete, or make

available for editing Visual Basic references to libraries or other

workbooks that are specified for the active workbook. You must be in

a Visual Basic module to use this command.

If you try to run a Visual Basic macro that has a reference to a file or

library, and the file or library does not exist in the specified location,

you will receive the error message above. To check the location of any

references your workbook may have, follow the steps below:

1. From the Tools menu, choose References.

2. Select any reference listed in the Available References list box.

The path to the file will be displayed in the Group box at the bottom of

the References dialog box.

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, chapter 4, "Organizing

Procedures and Modules in Workbooks"

For more information about the Reference command, choose the Search button

in Help and type:

   Reference command (Tools menu)

KBCategory: kbprg kberrmsg

KBSubcategory:

Additional reference words: 7.00 5.00


XL5: TRANS.EXE Not Installed with Custom or Complete Install

Article ID: Q124383

-------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0

-------------------------------------------------------------

SUMMARY

=======

The Macro Translation Assistant, TRANS.EXE, and its support files,

TRANSMP.XLM and TRANS123.XLM, are not installed when you select the

Complete or Custom installation option in the versions of Microsoft Excel

mentioned above. The Macro Translation Assistant is a utility that helps

you translate Lotus 1-2-3 macros and Microsoft Multiplan macros to

Microsoft Excel 4.0 macros.

NOTE: TRANS.EXE is not available in Microsoft Excel versions 5.0c and

later.

MORE INFORMATION

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

The TRANS.EXE program is not installed automatically when you perform a

complete installation of Microsoft Excel. This is by design in the versions

of Microsoft Excel mentioned above. If you are updating from Microsoft

Excel version 4.0 for Windows, TRANS.EXE should be located in the Microsoft

Excel 4.0 directory. If you are not updating from version 4.0, do the

following to install TRANS.EXE from Microsoft Excel 5.0 Setup:

1. Run the Microsoft Excel Setup program located in the Microsoft Excel

   program group.

2. Choose the Add/Remove button.

3. Select Tools from the Options list and choose Change.

4. Select the Macro Translation Assistant and the 1-2-3 CNF Converter and

   choose the OK button.

5. Choose Continue.

6. Insert the Microsoft Excel version 5.0 Disk 1 into the floppy disk

   drive and choose OK.

Setup will install all of the necessary components to your system.

KBCategory: kbsetup

KBSubcategory:

Additional reference words: 5.00


XL5: Cannot Change or Delete Constraints in Solver

Article ID: Q124499

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel 5.0, when you try to change or delete the constraints in

the Solver model, you may receive an error message. If you change the

constraints, you may receive the error message:

   Solver: An unexpected internal error occurred, or available

   memory was exhausted ($C$187). Please verify that your

   model is correctly entered and all cells contain numeric values.

If you try to delete the constraints in the Solver model, you may receive

the error message:

   Run-time error '13':

   Type mismatch

CAUSE

=====

You can get these error messages if you are using defined names in the

cells that are set to change in the Solver Parameters dialog box.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. This problem was corrected in

Microsoft Excel for Windows 95, version 7.0.

WORKAROUND

==========

To change or delete existing constraints in your Solver model, do the

following:

1. If you are currently in the Solver Parameters dialog box, select the

   Close button.

2. Delete any defined names for the cells that are set to change in the

   Solver Parameters dialog box.

3. From the Insert menu, choose Name and then choose Define.

4. Select the relevant defined name, and choose Delete.

5. Repeat step 2 for each defined name that needs to be deleted.

6. In the Define Name dialog box, choose OK.

7. From the Tools menu, choose Solver.

8. In the Solver Parameters Dialog box, choose Change or Delete.

You should now be able to change or delete constraints.

MORE INFORMATION

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

REFERENCES

==========

"Excel User's Guide" version 5.0, Chapter 29, "Using Solver to Analyze

Multiple-Variable Problems" and Chapter 30, "Examples of Using Solver".

For more information about Solver, choose the Search button in

Help and type:

   Solver Constraints

KBCategory: kbtool

KBSubcategory:

Additional reference words: 5.00


XL: Can't Use Find/Replace on Text with Leading Apostrophe

Article ID: Q124739

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you enter text that begins with an apostrophe

character (') in the Find What box in the Find or Replace dialog box,

you receive the following error message if you choose the Find Next

button

   Cannot find matching data

or the following error message if you choose the Replace All button:

   Cannot find matching data to replace

CAUSE

=====

The engine for the Find and Find Next commands does not recognize a

leading apostrophe character, because this character in this position

is designed to be transparent.

WORKAROUNDS

===========

To work around this problem, use any of the following methods.

Method 1: To replace the contents of a single cell that contains text that

          begins with an apostrophe character, do the following:

          a. Select the cell that contains the text that you want to

             replace, and choose Replace from the Edit menu.

          b. In the Find What box, type the text that you want to replace,

             such as "'xxx" (without the quotation marks).

          c. In the Replace With box, type the text that you want to appear

             in the cell, such as "zzz" (without the quotation marks) and

             choose Replace.

Method 2: To replace the contents of multiple cells that contain text

          entries that begin with apostrophes, use the following Visual

          Basic procedure to remove hidden leading apostrophes from a

          selected range of cells.

          Microsoft provides examples of Visual Basic procedures for

          illustration only, without warranty either expressed or implied,

          including but not limited to the implied warranties of

          merchantability and/or fitness for a particular purpose. This

          Visual Basic procedure is provided 'as is' and Microsoft does not

          guarantee that it can be used in all situations. Microsoft does

          not support modifications of this procedure to suit customer

          requirements for a particular purpose.

             ' Removes hidden apostrophes as first character

             ' Works on Formulas as well as text and values

             Sub RemoveApostrophe()

                For Each CurrentCell In Selection

                   If CurrentCell.HasFormula = False Then

                      ' Checks to make sure that procedure does not

                      ' change cell with a formula to be only the value

                      CurrentCell.Formula = CurrentCell.Value

                   End If

                Next

             End Sub

Method 3: To replace the contents of a single cell, or multiple cells that

          contain text that begins with an apostrophe character, do the

          following:

          a. On an empty cell on the worksheet, enter the value 1.

          b. Select the cell that contains the value 1, and choose Copy

             from the Edit menu.

          c. Select the cell(s) that contain the text that you want to

             replace, and choose Paste Special from the Edit menu.

          d. Under Paste, select the Values option. Under Operation,

             select the Multiply option, and choose OK.

REFERENCES

==========

For more information about Finding And Replacing Text Or Numbers,

choose the Search button in Help and type:

    replacing

KBCategory: kbusage kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Left/Right-Aligned Header/Footer Text Ignores Margins

Article ID: Q124751

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for the Macintosh, versions 3.0, 4.0, 5.0, 5.0a

 - Microsoft Excel for Windows, versions 3.0, 4.0, 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, the header and footer on your worksheet always use a

left and right margin of 0.75 inch. Because of this, left-aligned text in

the header or footer will always begin 0.75 inches from the left edge of

the page, regardless of the left margin setting. Similarly, right-aligned

text will always print 0.75 inches from the right side of the page.

WORKAROUND

==========

Although you cannot change these margins, you can create wider margins by

adding extra spaces ("padding") to the header or footer.

To pad the left header or footer, you can add spaces before the text.

However, because the right header or footer ignores trailing spaces, you

must use a nonbreaking space to allow the spaces to be maintained when you

add them to the end of your footer. To pad the right header or footer with

spaces, use the appropriate procedure below.

Microsoft Excel version 7.0 for Windows 95

------------------------------------------

1. On the File menu, click Page Setup, click the Header/Footer tab.

2. Click the Header/Footer, and click the Custom Header or Custom Footer

   button.

3. Type in the text or control codes that you want to appear in the header

   or footer followed by space characters to pad the text on the right.

   (Note that the spaces will not appear at the end of the text.)

4. To enter a nonbreaking space, press and hold down the ALT key and type

   0160 on the numeric keypad. Note that NUM LOCK must be turned on in

   order for this procedure to work.

   Typing 0160 will insert a nonbreaking space at the end of the right

   header or footer.

The spaces at the end of the text string should now appear and will be

applied to the printed output.

Microsoft Excel 5.0 for Windows

-------------------------------

1. On the File menu, click Page Setup, click the Header/Footer tab, and

   click the Customize button.

2. Click the Right Section.

3. Type in the text or control codes that you want to appear in the header,

   followed by space characters to pad the text on the right. Note that

   the spaces will not appear at the end of the text.

4. To enter a nonbreaking space, press and hold down the ALT key and type

   0160 On the numeric keypad. Note that NUM LOCK must be turned on in

   order for this procedure to work.

   Typing 0160 will insert a nonbreaking space at the end of the right

   header or footer.

The spaces at the end of the text string should now appear and will be

applied to the printed output.

Microsoft Excel 4. 0 for Windows

--------------------------------

1. From the File menu, choose Page Setup.

2. Choose the Header or Footer button.

3. Select the Right Section.

4. Type in the text or control codes that you want to appear in the header

   or footer.

5. To enter a nonbreaking space, press and hold down the ALT key and type

   0160 on the numeric keypad. Note that NUM LOCK must be turned on in

   order for this procedure to work.

The spaces at the end of the text string will appear on the printout.

Microsoft Excel 5. 0 for the Macintosh

--------------------------------------

1. From the File menu, choose Page Setup, select the Header/Footer tab, and

   choose the Customize button.

2. Select the Right Section.

3. Type in the text or control codes that you want to appear in the header.

4. Press OPTION+SHIFT to enter nonbreaking spaces (press this key

   combination as many times as necessary to get the desired number of

   spaces).

The spaces at the end of the text string will be applied to the printed

output.

MORE INFORMATION

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

Note that when you print to legal size paper, left-aligned text in the

header or footer prints approximately 1 inch from the left side of the

page. This is to allow for the limitations of the LaserWriter when printing

to legal size paper.

REFERENCES

==========

"Microsoft Excel User's Guide," version 5.0, page 243

"Microsoft Excel User's Guide," version 4.0, page 535

KBCategory: kbprint

KBSubcategory:

Additional reference words: 3.00 4.00 5.00 5.00a 5.00c


XL: Print/Preview Worksheet with OLE Object Causes GP Fault

Article ID: Q124807

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you print or view a worksheet in print preview,

you may receive a general protection (GP) fault if the worksheet contains

an OLE object.

CAUSE

=====

This problem occurs if all of the following are true:

 - The worksheet contains multiple pages

   -and-

 - You have set a horizontal print title or a row to print at the top of

   every page on the worksheet

   -and-

 - You have not saved the worksheet since you set the print title

   -and-

 - The OLE object on the worksheet is an object that supports in-place

   editing, such as a Microsoft Equation 2.0 object, a Microsoft Draw 2.0

   object, or a Microsoft Word 6.0 Document object.

The problem occurs when you print the entire file, or when you view it in

print preview and you use the Next button or the vertical scroll bar to

view the entire file.

This problem does not occur if you save the worksheet after you set

the print title. This is true even if you then remove the print

title, and add a print title again. However, if you remove the print

title, save the worksheet, and then add a print title again, the

problem occurs.

This problem does not occur with a vertical (column) print title.

WORKAROUND

==========

To avoid receiving a GP fault when you print your worksheet or view

it in print preview, save the file that contains the worksheet after

you insert a horizontal (row) print title.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft

products listed at the beginning of this article. We are researching

this problem and will post new information here in the Microsoft

Knowledge Base as it becomes available.

REFERENCES

==========

For more information about Printing Titles On Multiple Pages, choose

the Search button in Help and type:

    titles

KBCategory: kbprint kbole

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c gpf


XL: VB Procedure to Emulate Find Command

Article ID: Q124924

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

You can create a Visual Basic, Applications Edition, procedure that

emulates the behavior of the Microsoft Excel Find command. To do this, use

the Find and FindNext methods in a Visual Basic module.

The code in the "More Information" section of this article enables you to

find all occurrences of a search string in the active worksheet without

changing the selection or the active cell. The code displays a message box

when the search text is located. If the search text is not found, a "Search

Value Not Found" message box is displayed.

NOTE: You can easily modify this code by replacing the MsgBox statements

with the code that you want to run whenever the search text is or is not

found.

MORE INFORMATION

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

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character ( _ ) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Sub FindStrings()

 Dim firstCell, nextCell, stringToFind As String

   'show an input box and return the entry to a variable

   stringToFind = Application.InputBox("String to find?", "Search String")

    'set an object variable to evaluate the Find command

    Set firstCell = Cells.Find(what:=stringToFind, lookat:=xlWhole, _

        searchdirection:=xlPrevious)

    'If the string is not found, show this message box

    If firstCell Is Nothing Then

        MsgBox "Search Value Not Found.", vbExclamation

    Else

        'otherwise, find the next occurrence of the search text

        nextCell = Cells.FindNext(after:=Range(firstCell.Address)).Address

        'and show it's address in a message box

        MsgBox nextCell

        'continue finding the next occurrence as long as the address of _

         the found cell is not the same as the first cell

        Do While firstCell.Address <> nextCell

            nextCell = Cells.FindNext(after:=Range(nextCell)).Address

            MsgBox nextCell

        Loop

    End If

End Sub

If the range in which the search text is to be found is in a small portion

of the worksheet, use the For...Each control structure instead of the Find

method (For...Each requires less code). The advantage to the Find method is

that it is faster than For...Each on large ranges such as an entire

worksheet.

If the string that you are searching for is only a portion of the contents

of a cell, use the "xlPart" constant for the lookat named argument of the

Find method.

REFERENCES

==========

"Visual Basic User's Guide," pages 148, 149

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q108892

   TITLE     : XL: Cells.Find Returns Error When No Match Found

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 FindNext Find Searching VBA


XL: Macro Recorder Can't Record Page Setup in Group Mode

Article ID: Q124934

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, if you use the macro recorder to record a macro for

changing page setup options (such as page orientation or margins) for a

group of sheets, the resulting macro only sets the options for the sheet

that is active when you recorded the macro--it does NOT set the option for

all of the selected sheets as expected.

CAUSE

=====

This problem occurs because the macro recorder records the sheet object as

ActiveSheet (which is a single sheet). Therefore, PageSetup becomes a

property of a single sheet.

In general, the macro recorder does not work well for recording actions on

multiple sheets. For additional information, please see the following

article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q126313

   TITLE     :XL5: Macro Doesn't Function on Multiple Sheets in Group Mode

WORKAROUND

==========

To work around this behavior, modify the macro so that it loops through

each sheet in the selection individually, as in the following example:

   Sub ChangePageSetup()

      ' Dimension variable x as Object type

      Dim x As Object

      ' Group select Sheet1, Sheet2, and Sheet3 worksheets

      ' Note that there are other methods for selecting multiple sheets

      Sheets(Array("sheet1", "sheet2", "sheet3")).Select

      ' Change page setup options for sheet

      For Each x In ActiveWindow.SelectedSheets

         With ActiveSheet.PageSetup

            .LeftMargin = Application.InchesToPoints(2)

            .RightMargin = Application.InchesToPoints(2)

            .Orientation = xlLandscape

         End With

      Next x

   End Sub

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

KBCategory: kbusage kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 5.00c 7.00 wrong page setup improper xl


XL: Creating Non-Default Text Labels on an XY (Scatter) Chart

Article ID: Q125178

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel 5.0, you can automatically attach text labels to data

points in an xy (scatter) chart. However, if you want to attach labels that

are different from the default labels, you must select the label and

manually enter a formula or text for the label.

MORE INFORMATION

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

To create labels for an xy (scatter) chart that are different from the

default labels, use the following procedure:

1. Double-click the chart to select it.

2. On the Insert menu, click Data Labels, and select Show Labels. Click OK.

   The labels for each data point will appear on the chart.

3. Click once on a data label to select it.

   A box will appear around the value of the data label.

4. With the data label selected, enter the label text or cell reference in

   the formula bar. For example, to link the label to the value in a cell,

   type the following

      =<cell reference>

   where <cell reference> is the cell reference for the text that you

   want to be displayed in the label.

5. Press ENTER.

Repeat steps 3-5 for each point that you to change from the default label.

Note that if you use this technique in a macro, you must use R1C1 notation.

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


Finding Graphic Objects Within a Range with TopLeftCell

Article ID: Q125179

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

Graphic objects, such as a chart or text box object, are drawn on the

object layer of a worksheet. The object layer is above the worksheet cells.

In Visual Basic, Applications Edition, you can obtain the object's cell

coordinates by using the TopLeftCell property.

MORE INFORMATION

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

The following Visual Basic macro determines whether a graphic object is

within the print range. If it is, the object is deleted. The TopLeftCell

property returns the cell that is under the top left portion of the graphic

object.

The items on a worksheet that would be considered part of the graphic

objects collection include:

   Arc, Button, ChartObject, CheckBox, Drawing, DropDown, GroupBox,

   GroupObject, Label, Line, ListBox, OLEObject, OptionButton, Oval,

   Picture, Rectangle, ScrollBar, Spinner, and TextBox.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Sub DeleteObjects()

    'Define a For-Each loop of all the drawing objects on the

    'active worksheet

    For Each DrawObj In ActiveSheet.DrawingObjects

       'Define Cell_Ref as the top left cell address of each Drawing Object

        Cell_Ref = DrawObj.TopLeftCell.Address

            'Define a For-Each loop of all the cells with the range

            ' Print_Area

            For Each Cell In Range("Print_Area")

           'If the Object's top left cell address is the same as a

           'cell in the print range

                If Cell_Ref = Cell.Address Then

                    'Then delete the object

                    DrawObj.Delete

                'End the IF statement

                End If

            'Loop through next Cell

            Next Cell

    'Loop through next DrawObj

    Next DrawObj

End Sub

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Can't Use ActivateMicrosoftApp Method to Activate Excel

Article ID: Q125181

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, you cannot use the ActivateMicrosoftApp method in a

Visual Basic procedure to activate Microsoft Excel.

CAUSE

=====

The ActivateMicrosoftApp method does not support activating Microsoft

Excel. You can use the ActivateMicrosoftApp method to activate one of the

following Microsoft Applications, using the corresponding Microsoft Excel

constant as the index argument:

   Microsoft Word            xlMicrosoftWord

   Microsoft PowerPoint      xlMicrosoftPowerPoint

   Microsoft Mail            xlMicrosoftMail

   Microsoft Access          xlMicrosoftAccess

   Microsoft FoxPro          xlMicrosoftFoxPro

   Microsoft Project         xlMicrosoftProject

   Microsoft Schedule Plus   xlMicrosoftSchedulePlus

Note that there is no Microsoft Excel constant defined for Microsoft Excel,

and you cannot activate the Microsoft Excel application using the

ActivateMicrosoftApp method.

WORKAROUND

==========

To activate Microsoft Excel in a Visual Basic procedure, use the

AppActivate method as in the following example:

   AppActivate "Microsoft Excel"

Note that the AppActivate statement activates the application with the

window title that you specify. For example, if a document window is

maximized in Microsoft Excel, the Microsoft Excel application title

includes the document name, such as Microsoft Excel--BOOK1.XLS. You must

specify the application window title exactly as it appears in the

application when you use the AppActivate method. The following example

saves the application window title in Microsoft Excel as the variable

"title" and then uses this variable with the AppActivate method later in

the procedure:

   Sub Test

      Dim title as String

      ' Set variable title equal to exact application window title

      title = Application.Caption

      ' Activate Microsoft Word

      ActivateMicrosoftApp (xlMicrosoftWord)

      ' Activate Microsoft Excel again

      AppActivate title

   End Sub

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

REFERENCES

==========

For more information about the AppActivate Statement, choose the Search

button in the Visual Basic Reference and type:

    AppActivate

For more information about the ActivateMicrosoftApp Method, choose the

Search button in the Visual Basic Reference and type:

   ActivateMicrosoftApp Method

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Macro to Select Every nth Row/Column

Article ID: Q125267

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can create a Visual Basic, Applications Edition,

macro to select every nth row within a currently selected contiguous range

on a worksheet. An example of such a procedure is provided below.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

The following macro selects every third row in the current selection. To

change the number of rows between each selected row, change the value of

the RowsBetween variable (for example, if you want to select every fourth

row, set RowsBetween equal to 4).

NOTE: You must have a contiguous range of cells selected before you run

this macro.

Sample Visual Basic Macro

-------------------------

Sub SelectEvery3rdRow()

 ' Initialize ColsSelection equal to the number of columns in the

 ' selection.

   ColsSelection = Selection.Columns.Count

 ' Initialize RowsSelection equal to the number of rows in your

 ' selection.

   RowsSelection = Selection.Rows.Count

 ' Initialize RowsBetween equal to three.

   RowsBetween = 3

 ' Initialize Diff equal to one row less than the first row number of the

 ' selection.

   Diff = Selection.Row - 1

 ' Resize the selection to be 1 column wide and the same number of rows

 ' long as the initial selection.

   Selection.Resize(RowsSelection, 1).Select

 ' Resize the selection to be every third row and the same number of

 ' columns wide as the original selection.

   Set FinalRange = Selection. _

                      Offset(RowsBetween - 1, 0).Resize(1,ColsSelection)

 ' Loop through each cell in the selection.

   For Each xCell In Selection

    ' If the row number is a multiple of 3, then . . .

      If xCell.Row Mod RowsBetween = Diff Then

       ' reset FinalRange to include the union of the current

       ' FinalRange and the same number of columns.

         Set FinalRange = Application.Union _

                             (FinalRange, xCell.Resize(1,ColsSelection))

    ' End check.

      End If

 ' Iterate loop.

   Next xCell

 ' Select the requested cells in the range.

   FinalRange.Select

End Sub

For an example of a similar Microsoft Excel 4.0 macro, please see the

following article(s) in the Microsoft Knowledge Base:

    ARTICLE-ID: Q103165

    TITLE     : Excel: Macro to Select a Range Every nth Row/Column

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Setting Default Save As to Microsoft Excel 4.0 File Format

Article ID: Q125270

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The following example allows you to save the active worksheet in a

Microsoft Excel workbook to the Microsoft Excel 4.0 Worksheet file

format by default. Note that this example can easily be modified to

save a workbook to any desired file format by default.

EXAMPLE

=======

This example describes a method that allows you to save a worksheet

to the Microsoft Excel 4.0 Worksheet file format by default by

choosing a menu command. The example involves the following steps:

 - Creating the Procedure

 - Adding the Procedure to a Menu

 - Creating an Add-in from the Procedure

To create the procedure

-----------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

1. From the Insert menu, choose Macro, and then choose Module.

2. In the new module, enter the following:

      Sub SaveAsDefault()

         ' Display the Save As Dialog box with Microsoft Excel 4.0

         ' Worksheet selected in the Save File As Type list

         ' The active sheet must be a worksheet or an error is returned

         Application.Dialogs(xlDialogSaveAs).Show ,xlExcel4

      End Sub

Note that in the above procedure, xlExcel4 is the FileFormat property

for the Microsoft Excel 4.0 Worksheet file format. You can substitute

any FileFormat property for this value to save a file to that

specific file format by default.

For a list of the different FileFormat properties that you can use,

choose the Search button in the Visual Basic Reference and type:

   FileFormat Property

To add the procedure to a menu

------------------------------

1. In the module that contains the SaveAsDefault procedure, choose Menu

   Editor from the Tools menu.

2. From the Menu Bars list, select Worksheet.

3. From the Menus list, select the menu that you want to add the procedure

   to, such as &File.

4. From the Menu Items list, select the menu item above which you want the

   new menu item added. (A new menu item is added above the selected menu

   item.) Choose the Insert button.

5. In the Caption box, type the text that you want to appear on the menu,

   such as "Save As Excel 4" (without the quotation marks).

6. From the Macro list, select SaveAsDefault. Choose OK.

Creating Add-in

---------------

1. In the module that contains the SaveAsDefault procedure, choose Make

   Add-in from the Tools menu.

2. In the File Name box, enter the name of the add-in, such as "XL4"

   (without the quotation marks).

3. Choose OK.

NOTE: To have the menu item appear each time you start Microsoft

Excel, you can copy this add-in file to the Microsoft Excel STARTUP

subdirectory.

In Microsoft Excel for the Macintosh, you can copy the file to the 'Excel

Startup Folder (5)' folder located in the System Folder:Preferences folder

(System 7.0 or later) or the System Folder (System 6.0).

REFERENCES

==========

For more information about the SaveAs Method, choose the Search button in

the Visual Basic Reference and type:

   SaveAs Method

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


Sample Macro to Open a Text File Without Displaying TextWizard

Article ID: Q125401

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

When you create a Visual Basic, Applications Edition, macro that contains

the following line

   Application.Dialogs(xlDialogOpen).Show

the Text Import Wizard is displayed automatically. If you want to suppress

the Text Import Wizard, you must use the OpenText method.

The code in the following sample macro uses the GetOpenFilename method to

obtain the name of the file the user wants to open. It then uses the

OpenText method to specify all the parameters for the Text Import Wizard

without having the Text Import Wizard display on the screen.

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line-

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

Sample Visual Basic Procedure

-----------------------------

Sub OpenWOTextImportWiz()

   Dim MyFile As String

   'Ask the user for the filename to open

   MyFile = Application.GetOpenFilename

   'Check for the Cancel button

   If MyFile = False Then Exit Sub

   'Open the Text file with the OpenText method

   Workbooks.OpenText Filename:=MyFile, Origin:=xlWindows, _

       StartRow:=1, DataType:=xlDelimited, TextQualifier _

       :=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _

       Semicolon:=False, Comma:=False, Space:=False, Other:=False, _

       FieldInfo:=Array(1, 1)

End Sub

Note that the OpenText method may require different parameters for your

specific macro.

For more information about the OpenText method, query on OpenText method in

Visual Basic Reference Help, or use the Macro Recorder and open a text file

to determine the correct parameters for your situation.

KBCategory: kbprg kbcode kbtool

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL5: Creating a Masked Password Dialog Box in Visual Basic

Article ID: Q125422

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can create a custom dialog box to prompt a user for

information using text boxes, buttons, or other dialog box controls.

Normally, when you type text in an edit box, the text is displayed as you

type. However, you can use a Visual Basic, Applications Edition procedure

to create the effect of a hidden, or "masked," edit box. This can be useful

for creating a password dialog box, where you do not want the text entered

in an edit box to be "visible." The following information describe how to

create this effect.

NOTE: This functionality is built into Microsoft Excel for Windows 95,

version 7.0.

MORE INFORMATION

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

To "mask" an edit box, you can create two edit boxes; one that's visible

and one that is hidden. While the user enters the password in the hidden

edit box, a Visual Basic procedure enters "masking" characters in the

visible edit box.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code-- comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic,

Applications Edition, programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual Basic

User's Guide."

To simulate the effect of a masked edit box, do the following:

1. Create a dialog sheet with a dialog frame that has an OK button, a

   Cancel button, and two edit boxes. The edit boxes should be the same

   size.

2. Drag one of the edit boxes off of the dialog frame on the dialog sheet.

   Select this edit box. In the Name box, type "EditHidden" (without the

   quotation marks) and press ENTER.

3. Position the second edit box on the dialog frame where you want the

   password to be entered.

4. On the dialog frame, select the second edit box. In the Name box, type

   "EditShown" (without the quotation marks) and press ENTER.

5. From the Tools menu, choose Tab Order. From the Tab Order list, select

   EditHidden. Click the up arrow button until EditHidden is at the

   top of the Tab Order list. Choose OK.

6. From the Insert menu, choose Macro, and then choose Module, to insert a

   new module sheet. In the new module, enter the following:

   ' Dimension variable as public

   Public CancelFlag As Boolean

   Sub Main()

      ' Dimension variables

      Dim password As String

      ' Set initial conditions

      CancelFlag = False

      DialogSheets(1).EditBoxes("EditHidden").Text = ""

      ' Loop while password is incorrect and cancel button not pressed

      While password <> "hello" And CancelFlag = False

         ' Set conditions for dialog box display

         DialogSheets(1).EditBoxes("EditShown").Text = ""

         DialogSheets(1).EditBoxes("EditShown").Enabled = False

         ' Display the dialog box

         DialogSheets(1).Show

         password = DialogSheets(1).EditBoxes("EditHidden").Text

      ' Continue loop until correct password is entered

      Wend

      ' Check to see if the Cancel button is chosen

      If CancelFlag = False Then

         ' If loop has ended and Cancel button has not been pressed,

         ' then password is correct

         MsgBox "Correct password entered"

      Else

         MsgBox "Dialog was canceled"

      End If

   End Sub

   ' Macro assigned to EditHidden Edit box

   Sub PasswordMask()

      ' Dimension variables

      Dim MaskString As String, i As Integer

      MaskString = ""

      ' Match mask string length to length of text entered

      For i = 1 To Len(DialogSheets(1).EditBoxes("EditHidden").Text)

         MaskString = MaskString & "*"

      Next i

      ' Enter mask string in EditShown Edit box

      DialogSheets(1).EditBoxes("EditShown").Text = MaskString

   End Sub

   ' Macro assigned to the Cancel button

   Sub Canceled()

      ' Cancel chosen, set CancelFlag value to True

      CancelFlag = True

   End Sub

7. Select the dialog sheet tab to active the sheet that contains your

   dialog box. On the dialog sheet, select the "EditHidden" edit box, and

   choose Assign Macro from the Tools menu. From the Macro Name/Reference

   list, select PasswordMask and choose OK.

8. On the dialog box, select the Cancel button, and choose Assign Macro

   from the Tools menu. From the Macro Name/Reference list, select Canceled

   and choose OK.

9. From the Tools menu, choose Macro. From the Macro Name/Reference list,

   select Main and choose Run.

The dialog box that you created is displayed. As you type your password,

the actual text that you type is entered in the hidden edit box outside the

dialog frame. The asterisk character (*) is displayed for each character

that you type in the visible edit box within the dialog frame. The dialog

box will continue to be displayed until you enter the correct password or

until you choose the Cancel button.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 5.00 5.00a 5.00c entry field  hide hidden

astericks asterix


XL: How to Delete and Restore a Menu That Has a Submenu

Article ID: Q125423

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In a Visual Basic macro, if you delete a menu item that has a submenu and

you want to restore it, use the Addmenu command, not the Add command.

Addmenu adds a new menu (or submenu), while Add adds a new menu item.

MORE INFORMATION

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

The following Visual Basic Procedure restores a menu item that has a

submenu.

Sample Visual Basic Code

------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

If you want to delete the Protection submenu from the Tools menu, use the

following code:

   Sub DeleteIt()

       MenuBars(xlWorksheet).Menus("Tools").MenuItems("Protection").Delete

   End Sub

If you then want to restore the Protection submenu to the Tools menu, use

the following code:

   Sub AddBack

      MenuBars(xlWorksheet).Menus("Tools").MenuItems.AddMenu _

      Caption:="Protection",restore:=True, before:="Add-Ins..."

   End Sub

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 XL5


XL: Disabling OLE Services in Windows NT Hangs MS Excel

Article ID: Q125588

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Windows NT, version 3.5

--------------------------------------------------------------------

SYMPTOMS

========

When you attempt to start Microsoft Excel for Windows or Windows NT, on a

Microsoft Windows NT workstation using a Microsoft Windows NT server, you

may receive error messages if the OLE Service has been changed from the

default. Specifically, Microsoft Excel will stop responding (hang) and you

will receive an error message similar to one of the messages listed below.

If you are using Microsoft Excel for Windows:

   An error has occurred in your application. If you choose Ignore, you

   should save your work in a new file. If you choose Close, your

   application will terminate

Choosing Ignore will repeat the error. If you choose Close, the following

error message is displayed:

   Excel caused a General Protection Fault in EXCEL.EXE at 0014:0D29

If you are using Microsoft Excel for Windows NT:

      Dr. Watson for NT: An application error has occurred and an

      application error log is being generated.

      Excel.exe

      Exception: access violation (oxc0000005), Address 0x3f720545

The above message will be displayed very briefly and the Microsoft Excel

will terminate.

NOTE: The addresses in the error messages may vary. Also, Windows NT

Server's behavior may vary according to which applications are running.

Note also that Microsoft Excel may sometimes open when the OLE service is

not started if the Startup Type is set to Automatic.

CAUSE

=====

These errors occur because the OLE service has been stopped (disabled) in

Services (a Control Panel item) in Windows NT Workstation or Windows NT

Server. The OLE service must be started before you start Microsoft Excel.

RESOLUTION

==========

To avoid this problem, start the OLE service before you start Microsoft

Excel. In addition, to prevent future occurrences of this error, set the

Startup Type of the OLE service to Automatic.

To start OLE Services and set the Startup type to Automatic

-----------------------------------------------------------

1. From the Control Panel icon, start Services.

2. From the list of Services, select the OLE service.

3. Choose Start.

   The Status should be "Started."

4. Choose Startup.

5. Change the Startup Type to Automatic, and then choose OK.

6. Choose Close to exit the Services dialog box, and then close the Control

   Panel window.

You should now be able to open Microsoft Excel without receiving an error.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

REFERENCES

==========

"Microsoft Windows NT Workstation System Guide," version 3.5, Pages 14,

189-192

"Microsoft Windows NT Server System Guide," version 3.5, Pages 475-479

KBCategory: kbole kbenv

KBSubcategory:

Additional reference words: 7.00 5.00 crash gpf


XL: Can't Set Print Area or Print Titles

Article ID: Q125640

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you will be unable to set a print area or print titles

if more than one worksheet is selected. In this situation, when you choose

Page Setup from the File menu, and you then select the Sheet tab, the

following options are dimmed (unavailable):

 - Print Area

 - Rows To Repeat At Top

 - Columns To Repeat At Left

In addition, if the Set Print Area toolbar button has been added to the

toolbar, it beeps when you click it.

MORE INFORMATION

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

It may be difficult to determine whether more than one worksheet is

selected if any of the following conditions is true:

 - If the in Color Settings in Windows Control Panel, the Button Face

   setting is set to white.

   -or-

 - If there are many sheets in your workbook.

   -or-

 - If sheets in more than one workbook are selected.

To make sure that only one worksheet in one workbook is selected, do the

following:

1. Click another sheet tab.

2. From the File menu, choose Page Setup.

Print Area and Print Titles should now be available.

If this procedure does not work, press CTRL+PAGE DOWN or CTRL+PAGE UP, or

choose Worksheet from the Insert menu to create a new sheet, and then

choose Delete Sheet from the Edit menu to delete the new sheet, and click

OK.

MORE INFORMATION

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

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q112681

   TITLE     : XL: Can't Use Group Edit Mode on Multiple Workbooks

For more information on setting print area and print titles or on the

Set Print Area Button, choose the Search button in Help and type:

   specifying print area

Click the Show Topics button, and then go to "Specifying an area of a

worksheet to print."

KBCategory: kbprint

KBSubcategory:

Additional reference words: 7.00 5.00 printarea grayed unavailable greyed

group edit mode


XL: Visual Basic Macro to List Circular References

Article ID: Q125848

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

In a Microsoft Excel worksheet, when a formula in a cell refers to the same

cell it occupies, either directly or indirectly, a circular reference is

created. In Microsoft Excel version 5.0, tracing tools are provided on the

Auditing toolbar to help you locate unwanted circular references. Another

way you can trace circular references is to create a Visual Basic,

Applications Edition, macro that will produce a list of all cells

containing circular references that occur in a single worksheet.

MORE INFORMATION

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

Precedents are the cells referenced, directly or indirectly, by a formula.

A circular reference occurs whenever the cell containing the circular

reference formula is included in the formula's precedents.

The following Visual Basic macro will generate a new sheet in a workbook

and list all circular references found on the active worksheet. The macro

does this by testing each formula in the sheet to see if the cell

containing the formula intersects the precedents of the formula.

NOTE: A limitation of this method is that the Precedents property in Visual

Basic for Applications can only find precedents on the active sheet. The

macro below will not find a circular reference that is caused by a remote

reference.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character (_) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

On a module sheet, enter the following Visual Basic code:

Sub FindCircRefs()

    'Get source info

   sourcesheet = ActiveSheet.Name

   Sheets.Add

   'Get destination info

   destsheet = ActiveSheet.Name

   destrange = ActiveCell.Address

   'Return to source

   Worksheets(sourcesheet).Activate

   rowcount = 0

   'Trap for error in "result", indicating no circular reference

   On Error GoTo notcircular

   'Loop through every used cell in source

   For Each Item In ActiveSheet.UsedRange

      'Check to see if cell contains a formula

      If Left(Item.Formula, 1) = "=" Then

      'If cell intersects with precedents, cell has circular reference

      result = Intersect(ActiveSheet.Range(Item.Address), _

      ActiveSheet.Range(Item.Precedents.Address))

      Worksheets(destsheet).Range(destrange).Offset(rowcount, 0).Value = _

      Item.Address(False, False)

      Worksheets(destsheet).Range(destrange).Offset(rowcount, 1).Value = _

      "'" & Item.Formula

      rowcount = rowcount + 1

'Skip to here if not circular

skipitem:

      End If

   Next

Exit Sub

'If error in "result", go here

notcircular:

'Skip cells that do not contain circular references

    Resume skipitem

End Sub

To use this macro, run the FindCircRefs macro from the Microsoft Excel

worksheet for which you want to find circular references. A new sheet will

be added to the active workbook, listing the cell addresses of circular

references in column A, and the formula at that address in column B. If no

circular references are found, the new sheet will be empty.

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Sending Mail from MS Excel Using VBAMAPI.DLL (Part 1)

Article ID: Q125854

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

----------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, you can use the SendMail method in a Visual Basic macro

for basic electronic mail (E-mail) functionality. However, for more

complete control of mail, including message content, subject, return

receipt, and recipients, you must use the VBAMAPI.DLL file, which currently

ships with Microsoft Project version 4.0 for Windows (this file is located

on Setup Disk 2).

If you do not have Microsoft Project version 4.0, you can obtain this file

by downloading and running VBAMAPI.EXE, a self-extracting file, from the

Microsoft Software Library (MSL) on the following services:

 - CompuServe

      GO MSL

      Search for VBAMAPI.EXE

      Display results and download

 - Microsoft Download Service (MSDL)

      Dial (206) 936-6735 to connect to MSDL

      Download VBAMAPI.EXE

 - Internet (anonymous FTP)

      ftp ftp.microsoft.com

      Change to the \SOFTLIB\MSLFILES directory

      Get VBAMAPI.EXE

Note that if you use VBAMAPI.DLL with Microsoft Excel, use the built-in

MailLogon and MailLogoff methods.

Once you've downloaded the file, copy it to your Windows SYSTEM directory.

The information in the "More Information" section of this article contains

Declare functions and data type definitions necessary to use VBAMAPI.DLL.

For more information about using MAPI with Microsoft Excel for Windows,

please see the following articles:

   ARTICLE-ID:Q125853

   TITLE     :XL: Sending Mail from MS Excel using VBAMAPI.DLL (Part 2)

   ARTICLE-ID: Q123185

   TITLE     : GP Fault Using MAPI.DLL Calls in Visual Basic Procedure

MORE INFORMATION

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

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

'***************************

'   FUNCTION Declarations

'***************************

'For best results please enter each of the DeclareFunction

'on a separate line

Declare Function MAPILogon Lib "MAPI.DLL" (ByVal UIParam&, ByVal

User$, ByVal Password$, ByVal Flags&, ByVal Reserved&, Session&) As

Long

Declare Function MAPILogoff Lib "MAPI.DLL" (ByVal Session&, ByVal

UIParam&, ByVal Flags&, ByVal Reserved&) As Long

Declare Function MAPIDetails Lib "MAPI.DLL" (ByVal Session&, ByVal

UIParam&, Recipient As MapiRecip, ByVal Flags&, ByVal Reserved&) As

Long

Declare Function MAPIResolveName Lib "VBAMAPI.DLL" Alias

"BMAPIResolveName" (ByVal Session&, ByVal UIParam&, ByVal UserName$,

ByVal Flags&, ByVal Reserved&, Recipient As MapiRecip) As Long

Declare Function MAPISendDocuments Lib "MAPI.DLL" (ByVal UIParam&,

ByVal DelimStr$, ByVal FilePaths$, ByVal FileNames$, ByVal Reserved&)

As Long

Declare Function MAPIFindNext Lib "VBAMAPI.DLL" Alias "BMAPIFindNext"

(ByVal Session&, ByVal UIParam&, MsgType$, SeedMsgID$, ByVal Flag&,

ByVal Reserved&, MsgID$) As Long

Declare Function MAPIDeleteMail Lib "MAPI.DLL" (ByVal Session&, ByVal

UIParam&, ByVal MsgID$, ByVal Flags&, ByVal Reserved&) As Long

Declare Function MAPIAddress Lib "VBAMAPI.DLL" Alias "BMAPIAddress"

(ByVal Session&, ByVal UIParam&, Caption$, ByVal EditFields&, Label$,

RecipCount&, Recipients() As MapiRecip, ByVal Flags&, ByVal

Reserved&) As Long

Declare Function MAPISaveMail Lib "VBAMAPI.DLL" Alias "BMAPISaveMail"

(ByVal Session&, ByVal UIParam&, Message As MapiMessage, Recipient As

MapiRecip, File As MapiFile, ByVal Flags&, ByVal Reserved&, MsgID$)

As Long

Declare Function MAPISendMail Lib "VBAMAPI.DLL" Alias "BMAPISendMail"

(ByVal Session&, ByVal UIParam&, Message As MapiMessage, Recipient As

MapiRecip, File As MapiFile, ByVal Flags&, ByVal Reserved&) As Long

Declare Function MAPIReadMail Lib "VBAMAPI.DLL" Alias "BMAPIReadMail"

(ByVal Session&, ByVal UIParam&, ByVal MsgID$, ByVal Flags&, ByVal

Reserved&, Message As MapiMessage, Originator As MapiRecip, Recips()

As MapiRecip, Files() As MapiFile) As Long

Declare Function GetProfileInt Lib "KERNEL" (ByVal lpAppName As

String, ByVal lpKeyName As String, ByVal nDefault As Integer) As

Integer

'***************************************************

'   MAPI Message holds information about a message

'***************************************************

Type MapiMessage

    Reserved As Long

    Subject As String

    NoteText As String

    MessageType As String

    DateReceived As String

    ConversationID As String

    Flags As Long

    RecipCount As Long

    FileCount As Long

End Type

'************************************************

'   MAPIRecip holds information about a message

'   originator or recipient

'************************************************

Type MapiRecip

    Reserved As Long

    RecipClass As Long

    Name As String

    Address As String

    EIDSize As Long

    EntryID As String

End Type

'******************************************************

'   MapiFile holds information about file attachments

'******************************************************

Type MapiFile

    Reserved As Long

    Flags As Long

    Position As Long

    PathName As String

    FileName As String

    FileType As String

End Type

'**************************

'   CONSTANT Declarations

'**************************

'

Global Const SUCCESS_SUCCESS = 0

Global Const MAPI_USER_ABORT = 1

Global Const MAPI_E_FAILURE = 2

Global Const MAPI_E_LOGIN_FAILURE = 3

Global Const MAPI_E_DISK_FULL = 4

Global Const MAPI_E_INSUFFICIENT_MEMORY = 5

Global Const MAPI_E_BLK_TOO_SMALL = 6

Global Const MAPI_E_TOO_MANY_SESSIONS = 8

Global Const MAPI_E_TOO_MANY_FILES = 9

Global Const MAPI_E_TOO_MANY_RECIPIENTS = 10

Global Const MAPI_E_ATTACHMENT_NOT_FOUND = 11

Global Const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12

Global Const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13

Global Const MAPI_E_UNKNOWN_RECIPIENT = 14

Global Const MAPI_E_BAD_RECIPTYPE = 15

Global Const MAPI_E_NO_MESSAGES = 16

Global Const MAPI_E_INVALID_MESSAGE = 17

Global Const MAPI_E_TEXT_TOO_LARGE = 18

Global Const MAPI_E_INVALID_SESSION = 19

Global Const MAPI_E_TYPE_NOT_SUPPORTED = 20

Global Const MAPI_E_AMBIGUOUS_RECIPIENT = 21

Global Const MAPI_E_MESSAGE_IN_USE = 22

Global Const MAPI_E_NETWORK_FAILURE = 23

Global Const MAPI_E_INVALID_EDITFIELDS = 24

Global Const MAPI_E_INVALID_RECIPS = 25

Global Const MAPI_E_NOT_SUPPORTED = 26

Global Const MAPI_ORIG = 0

Global Const MAPI_TO = 1

Global Const MAPI_CC = 2

Global Const MAPI_BCC = 3

Global Const MAPI_UNREAD = 1

Global Const MAPI_RECEIPT_REQUESTED = 2

Global Const MAPI_SENT = 4

'***********************

'   FLAG Declarations

'***********************

Global Const MAPI_LOGON_UI = &h1

Global Const MAPI_NEW_SESSION = &h2

Global Const MAPI_DIALOG = &h8

Global Const MAPI_UNREAD_ONLY = &h20

Global Const MAPI_ENVELOPE_ONLY = &h40

Global Const MAPI_PEEK = &h80

Global Const MAPI_GUARANTEE_FIFO = &h100

Global Const MAPI_BODY_AS_FILE = &h200

Global Const MAPI_AB_NOMODIFY = &h400

Global Const MAPI_SUPPRESS_ATTACH = &h800

Global Const MAPI_FORCE_DOWNLOAD = &h1000

Global Const MAPI_OLE = &h1

Global Const MAPI_OLE_STATIC = &h2

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00


XL: Macros to Delete Formula Links

Article ID: Q126093

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

---------------------------------------------------------------------

SUMMARY

=======

When you open a document that contains links, Microsoft Excel will ask

you if you want to update links. If the file that the link is referring to

no longer exists, or if it has been moved to a different directory, you may

want to delete the links to avoid this message.

MORE INFORMATION

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

One of the most common link types is a formula link. A link formula in a

cell can refer to a cell on a closed document. If that document no longer

exists, the formula is no longer valid. To delete such a link, choose Edit

from the Find menu, and search for an exclamation point. This will show

each link in a sheet. You can then go to each cell, delete the formula, and

replace it with the value that was in the cell. If many cells contain

links, deleting the links may take some time. To speed up the deletion

process, you may want to use one of the following macros. The macro will

allow you to delete some links and not others.

Note that the Visual Basic Code Example is specifically for Microsoft Excel

5.0. And, note that the Microsoft Excel 4.0 example will not work in

Microsoft Excel 5.0 because of the difference in the link formulas. A link

formula in Microsoft Excel 5.0 might be

   ='c:\excel\[book1.xls]sheet1'!$a$1

while a Microsoft Excel 4.0 link would be:

   ='c:\excel\sheet1.xls'!$a$1

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

'----------------------------------------------------------------------

'This macro will delete all formula links in a workbook. To delete only

'the links in the active sheet, see the comments below.

Public Times As Integer

Public Link_Array As Variant

Sub Should_Delete()

   Items = 0 'initialize these names

   Times = 0

   Link_Array = ActiveWorkbook.LinkSources 'find all links in the document

   Items = UBound(Link_Array) 'count the number of links

   For Times = 1 To Items

   'Ask whether to delete each link

      Msg = "Do you want to delete this link:  " & Link_Array(Times)

      Style = vbYesNoCancel + vbQuestion + vbDefaultButton2

      Response = MsgBox(Msg, Style)

      If Response = vbYes Then Delete_It

      If Response = vbCancel Then Times = Items

   Next Times

End Sub

Sub Delete_It()

   Count = Len(Link_Array(Times))

   For Find_Bracket = 1 To Count

      'replace the "\" in the next line with a ":" if you are using

      'Microsoft Excel for the Macintosh

      If Mid(Link_Array(Times), Count - Find_Bracket, 1) = "\" _

      Then Exit For

   Next Find_Bracket

   'add brackets around the filename

   With_Brackets = Left(Link_Array(Times), Count - Find_Bracket) & "[" & _

      Right(Link_Array(Times), Find_Bracket) & "]"

   'Does the replace

   'If you want to remove links only on the active sheet, change the next

   'two lines into comments by placing an apostrophe in front of them

   For Each Sheet_Select In ActiveWorkbook.Worksheets

      Sheet_Select.Activate

      Set Found_Link = Cells.Find(what:=With_Brackets, After:=ActiveCell, _

            lookin:=xlFormulas, lookat:=xlPart, searchorder:=xlByRows, _

            searchdirection:=xlNext, matchcase:=False)

       While TypeName(Found_Link) <> "Nothing"

           Found_Link.Activate

           Found_Link.Formula = Found_Link.Value

           Set Found_Link = Cells.FindNext(After:=ActiveCell)

       Wend

   Next Sheet_Select 'To remove links only on the active sheet

                     'place an apostrophe at the front of this line

End Sub

'----------------------------------------------------------------------

Microsoft Excel 4.0 Example

---------------------------

Microsoft provides macro examples for illustration only, without warranty

either expressed or implied, including but not limited to the implied

warranties of merchantability and/or fitness for a particular purpose. This

macro is provided 'as is' and Microsoft does not guarantee that the

following code can be used in all situations. Microsoft does not support

modifications of the code to suit customer requirements for a particular

purpose.

link=LINKS()

=FOR("counter",1,COLUMNS(link))

current=INDEX(link,,counter)

delete=ALERT("To remove the link:  "&current&", press OK. To leave it

     alone press Cancel",1)

=IF(delete=FALSE,NEXT())

search="='"&current&"*"

=ERROR(FALSE)

=FORMULA.FIND(search,1,2)

=FORMULA.REPLACE(search,GET.CELL(5),,,TRUE,FALSE)

test_error=TRUE

=WHILE(test_error=TRUE)

next_cell=FORMULA.FIND.NEXT()

=IF(next_cell=FALSE,SET.NAME("test_error","false"))

=FORMULA.REPLACE(search,GET.CELL(5),,,TRUE,FALSE)

=NEXT()

=ERROR(TRUE)

=NEXT()

=RETURN()

NOTE: The fifth line of this macro is a continuation of the fourth line.

REFERENCES

==========

"Function Reference," version 4.0, page 258-259

KBCategory: kbprg kbcode

KBSubcategory: kbmacro

Additional reference words: 7.00 5.00 macro


XL: Consolidated Labels Use Name of Workbook Instead of Sheet

Article ID: Q126100

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you use the Consolidate dialog box to consolidate

data on worksheets that are contained in the same workbook, if you choose

to display the left column labels, and you choose the Create Links To

Source Data check box, summary labels in the left column display the name

of the workbook instead of the sheet name.

CAUSE

=====

This behavior occurs because the Consolidate dialog box does not determine

that the consolidated data is contained on worksheets in the same workbook

and that the workbook name does not distinguish where the data is located.

For example, if you consolidate data from Sheet1 and Sheet2 in BOOK1, and

you select the Left Column check box (under Use Labels In) and the Create

Links To Source Data check box, the consolidated data may appear as

follows:

   A1:         B1: BOOK1   C1: 1000

   A2:         B2: BOOK1   C2: 1000

   A3: sales   B3:         C3: 2000

WORKAROUND

==========

To work around this behavior, on each of the worksheets that you are

consolidating, create the local name sheet_title that refers to a cell that

contains the worksheet name or the title that you want to appear in the

consolidated data. To do this, use the following procedure:

1. Select a worksheet that contains data that you want to consolidate.

2. In an empty cell on the worksheet, enter the worksheet name or any

   other title that you want to appear in the consolidated data.

3. Select the cell that contains the data that you entered in Step 2

   above.

4. From the Insert menu, choose name, and then choose Define. In the

   Names In Workbook box, type "SHEET1!sheet_title" (without the

   quotation marks) where SHEET1 is the name of the selected worksheet.

5. Choose OK.

Repeat Steps 1 through 5 with each worksheet that contains data that

you want to consolidate.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

MORE INFORMATION

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

When you use the Consolidate dialog box, the Use Labels In check box allows

you to choose whether to use labels from the top row of the source areas,

from the left column, both, or neither. These check boxes are meaningful

only when you consolidate data by category. Multiple source areas must be

laid out and labeled identically for this option to work accurately. When

you consolidate data by category, be sure to include the category labels in

the source areas you select for your consolidation. Microsoft Excel

transfers these labels to the destination area for you.

The Create Links To Source Data check box creates links from the

destination area to the source areas when you consolidate data so that the

destination area will be automatically updated whenever the source data

changes. Microsoft Excel creates a linking formula for every cell and

inserts rows or columns into the destination area to hold the linking

formulas for each piece of source data. The destination area is then

grouped with linking formulas placed in hidden rows or columns subordinate

to positions or categories in the destination area.

KBCategory: kbtool

KBSubcategory:

REFERENCES

==========

"Microsoft Excel User's Guide," version 5.0, pages 528-535

For an Overview Of Consolidating Data, choose the Search button in

Help and type:

   consolidating data

Additional reference words: 7.00 5.00 5.00c


XL: Using the Range Method to Convert String to a Range

Article ID: Q126367

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Visual Basic Programming System, Applications Edition,

   version 1.0

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, when you use the GoTo method in a Visual Basic,

Applications Edition procedure, you must use a Visual Basic object style

reference, such as the following:

   Worksheets("Sheet1").Range("A1")

However, many functions that return worksheet or chart values return the

<SheetName>!<CellReference> style reference.

Using string manipulation, it is possible to take a

<SheetName>!<CellReference> style reference result and use it as an

argument of the Range method. The Range method then converts a

<SheetName>!<CellReference> style reference to a Visual Basic object style

reference that can be used with the GoTo method. The following are examples

of using the Range method to accomplish this.

Converting Link Formula

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

To convert a simple Microsoft Excel link formula, for example

"=Sheet1!$A$1" to a Visual Basic style reference, you can strip the equal

sign (=) from the left side of the string and pass the remainder of the

formula to the Range object.

The following line of code selects the cell or range that is referenced by

the formula in the active cell:

   Application.GoTo _

      Range(Right(ActiveCell.Formula, Len(ActiveCell.Formula-1))

Converting Reference in Chart Series

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

To select a range that is referenced as a y value in the formula of a chart

series, the string manipulation becomes a bit more complex. The following

procedure strips the section of the series formula between the second and

third commas of the currently selected series and passes that string to the

Range object to select it.

Sub Select_The_Y_Values()

  Dim StartString As Integer

  Dim EndString As Integer

  Dim SeriesForm As String

    ' Assign the formula property of the selected series to

    ' the variable "SeriesForm"

    SeriesForm = Selection.Formula

    ' If a point is selected rather than the entire series, you will

    ' need to modify the above line to the following

    '  Selection.Parent.Formula

    ' Find the position of the first character after the second

    ' comma in the formula

    StartString = InStr(InStr(SeriesForm, ",") + 1, SeriesForm, ",") + 1

    ' Find the position of the third comma

    EndString = InStr(StartString, SeriesForm, ",")

    ' Strip out the y values (between the second and third commas)

    ref = Mid(SeriesForm, StartString, EndString - StartString)

    ' Pass the Y values to the Range object and select it

    Application.GoTo Range(ref)

End Sub

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose. Note that a line that is preceded by

an apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the procedure. Note

also that an underscore character ( _ ) indicates that code continues from

one line to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This Manual"

section in the "Document Conventions" section of the "Visual Basic User's

Guide."

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, Chapter 3, "Creating User

Defined Functions"

"Visual Basic User's Guide," version 5.0, Chapter 5, "Working with

Objects in Visual Basic"

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Menu Command Runs Macro from Wrong Add-In

Article ID: Q126663

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you create an add-in file, and you add a menu item

to the add-in that runs a macro contained in the add-in, when you open that

add-in file, and choose the menu item, the wrong macro may be run.

CAUSE

=====

This behavior occurs if you open an add-in that contains a macro with the

same name as the macro that is assigned to the menu item BEFORE you open

the add-in that actually contains the menu item and the macro that is

assigned to the menu item.

For example, if you create two different add-in files, RIGHT.XLA and

WRONG.XLA, that both contain a macro called "Test," and you add a menu item

to RIGHT.XLA that runs the macro Test in RIGHT.XLA, the macro "Test" in

WRONG.XLA runs when you choose the menu item if you open WRONG.XLA before

you open RIGHT.XLA.

WORKAROUND

==========

To avoid running the wrong macro when you choose a menu item that is

associated with an add-in file, use either of the following methods.

Method 1: When you create an add-in file, create macros in the add-in with

          names that are different from macro names in other add-in files

          that you use.

Method 2: If you have two or more add-in files that contain a macro with

          the same name, open the add-in that contains an added menu item

          before you open any other add-in file.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

REFERENCES

==========

For more information about the Menu Editor Command (Tools Menu), choose the

Search button in Help and type:

   menu Editor command (Tools menu)

KBCategory: kbprg

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c addin


XL: "Invalid External Reference" Using ChartWizard Method

Article ID: Q126817

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, you may receive the following error message when

you run a Visual Basic, Applications Edition, procedure that contains the

ChartWizard method:

   Run-time error '1004':

   External reference is not valid

CAUSE

=====

This problem occurs if the Source argument that you use with the

ChartWizard method contains a number of nonadjacent range references.

Note that the number of the range references that will cause this

error message depends on the length of the name of the worksheet that

the chart is created on.

For example, the following procedure correctly creates a chart on the

active sheet, Sheet1, (assuming that the range A1:B14 on Sheet1

contains data):

   Sub CreateChart()

      ActiveSheet.ChartObjects.Add(100, 40, 300, 200).Select

      Application.CutCopyMode = False

      ActiveChart.ChartWizard Source:= Range( _

        "A1:B1,A2:B2,A3:B3,A4:B4,A5:B5,A6:B6,A7:B7," _

        & "A8:B8,A9:B9,A10:B10,A11:B11,A12:B12,A13:B13")

   End Sub

If you add another reference in the Range object for the Source argument,

you receive the error message described above when you run the procedure.

This problem occurs because Visual Basic converts the range string

("A1:C1,A2:C2,...") into a parsed reference. When you use the

ChartWizard method with this reference, the ChartWizard method

converts this reference to a string. When this occurs, the reference

is converted to R1C1 format, and the sheet name is added to each

individual reference. This causes the reference string to exceed the

allotted buffer, and to be cut off. Because the reference is cut off,

you receive the error message above when the ChartWizard method

attempts to create the chart.

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of

merchantability and/or fitness for a particular purpose. This Visual

Basic procedure is provided 'as is' and Microsoft does not guarantee

that it can be used in all situations. Microsoft does not support

modifications of this procedure to suit customer requirements for a

particular purpose. Note that a line that is preceded by an

apostrophe introduces a comment in the code--comments are provided to

explain what the code is doing at a particular point in the

procedure. Note also that an underscore character (_) indicates that

code continues from one line to the next. You can type lines that

contain this character as one logical line or you can divide the

lines of code and include the line continuation character. For more

information about Visual Basic for Applications programming style,

see the "Programming Style in This Manual" section in the "Document

Conventions" section of the "Visual Basic User's Guide."

RESOLUTION

==========

To avoid receiving the error message above, use one of the following

methods.

Method 1: Use the MS Excel 4.0 Macro equivalent, CHART.WIZARD().

          The CHART.WIZARD() function works correctly with nonadjacent cell

          references because the range remains a string and does not need

          to be converted. The original string that you use as the Ref

          argument in the CHART.WIZARD function is the string that is

          parsed.

Method 2: Copy and paste the cells in the range from which you are creating

          the chart so that they appear as one contiguous range. This range

          can then be referred to as one single range in the ChartWizard

          method.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft Excel

versions listed above. We are researching this problem and will post

new information here in the Microsoft Knowledge Base as it becomes

available.

MORE INFORMATION

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

The ChartWizard method modifies the properties of the given chart and

allows a chart to be quickly formatted without setting all the

individual properties. This method is non-interactive and changes

only the specified properties.

One of the named arguments for the ChartWizard method is called Source. The

Source argument is used to specify the range that contains the source data

for the chart. It is required if you are creating a chart and is optional

if you are editing an existing chart.

If Source is omitted and the selection is not an embedded chart on the

active worksheet, or the active sheet is not an existing chart, the method

fails and an error occurs.

REFERENCES

==========

For more information about the ChartWizard Method, choose the Search

button in Help and type:

   ChartWizard Method

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL: Sorting Alpha-Numeric Text as Numeric Values

Article ID: Q126931

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SUMMARY

=======

In Microsoft Excel, the value in a cell will be sorted based on its

contents. That is, a value formatted as a number will be sorted differently

from a number formatted as text. Because of this difference, you may

receive unexpected results when you mix numeric and text strings in a sort.

MORE INFORMATION

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

When Microsoft Excel sorts text, it does so one character at a time from

left to right. For example, if you sort the values 1 and 1A, when these

values are formatted as text, the text with the fewest number of characters

is at the top (1) of the sorted values, while text with the greatest number

characters is at the bottom (1A). Each character is then sorted from 0 to 9

and then from A to Z.

For example, suppose you have the following values in a worksheet:

   A1:     1

   A2:     12

   A3:     1A1

   A4:     1A2

   A5:     2

The desired sort result is 1, 1A1, 1A2, 2, 12. However, the actual result

will be 1, 2, 12, 1A1, 1A2.

The following Visual Basic custom function can be used to perform the

desired sort result.

Sample Visual Basic Function

----------------------------

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

Type the following code in a module sheet:

' Assume a cell entry of 1A 'myvalue' is the cell reference of the number

' to be sorted

Function numsort(myvalue As Variant)

' Calculates the function any time the worksheet recalculates

Application.Volatile

' Initializes the variable count as 0

Count = 0

'If the cell is numeric, the variable 'count' is equal to the value in the

'cell times 1000

' 1A is not numeric

If IsNumeric(myvalue) Then

   Count = myvalue * 1000

Else

   no_text_yet = True

   ' Sets a For-Next loop from 1 to the length of characters in the cell.

   ' With 1A, the For-next loop will be from 1 to 2

    For x = 1 To Len(myvalue)

     ' Sets the variable 'current' to the character of position x, for a

     ' length of 1 character

     ' The first time through, 'current' will equal 1.

     ' The second time through, 'current' will equal A.

     current = Mid(myvalue, x, 1)

     If IsNumeric(current) Then

         ' If 'current' is numeric, then 'count' is equal to itself

         ' times ten plus 'current'

         ' The first time through, 'count' is numeric and will equal 1

         ' (0 * 1 + 1).

         ' The second time through, A is not numeric.

         Count = Count * 10 + current

    ' If 'current' is not numeric, then 'count' is equal to itself

    ' times 1000 plus the ASCII value of the letter.

    ' The first time through, 1 is numeric.

    ' The second time through, 'count' equals itself(1) times 1000 +

    ' the ASCII character value of A(65), or 1065

    Else

           Count = Count * 1000 + Asc(current)

           ' Exits the For-Next loop as soon as we reach the first alpha

           ' character

           Exit For

       End If

   Next

' If the For-Next loop variable is not equal to the length of characters of

' myvalue, then the last characters must be calculated.

If x <> Len(myvalue) Then Count = _

Count + Right(myvalue, Len(myvalue) - x) * 0.001

' This will happen as soon as we encounter the first alpha character.

' In this is the case, 'count' equals itself plus the right character of

' the total length minus the For-Next variable "x".

End If

numsort = Count

End Function

To Use the Custom Function

--------------------------

1. Enter the following in a worksheet:

      A1: 1

      A2: 12

      A3: 1A1

      A4: 1A2

      A5: 2

2. Select the range A1:A5, and choose Sort from the Data menu. Select the

   No Header Row option button in the My List Has group box, and Sort By

   Column A in ascending order.

3. The worksheet will be sorted as follows:

   A1: 1

   A2: 2

   A3: 12

   A4: 1A1

   A5: 1A2

4. Enter the following formula into cell B1:

      B1: =numsort(A1)

   NOTE: This should return a numeric value of 1000 for the number 1

   in cell A1.

5. With cell B1 selected, choose Copy from the Edit menu. Select cells

   B2:B5 and choose Paste from the Edit menu.

   The worksheet should have the following information in it:

      A1:     1     B1:     1000

      A2:     2     B2:     2000

      A3:     12    B3:     12000

      A4:     1A1   B4:     1065.001

      A5:     1A2   B5:     1065.002

6. Select the range A1:B5, and choose Sort from the Data menu. Select the

   No Header Row option in the My List Has box, and Sort By

   Column B in ascending order. The sort should return the following:

      A1:     1     B1:    1000

      A2:     1A1   B2:    1065.001

      A3:     1A2   B3:    1065.002

      A4:     2     B4:    2000

      A5:     12    B5:    12000

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5 5.0 5.00 sort weird wrong incorrect


"Cannot Access <FILENAME.XLA>" Opening Add-Ins Dialog Box

Article ID: Q126998

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0c

 - Microsoft Office for Windows, version 4.3c-CD

--------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Excel, when you choose Add-Ins from the Tools menu, you may

receive the following error message

   Cannot access '<FILENAME.XLA>'

where FILENAME.XLA is any of the following files:

   ATPVBAEN.XLA

   AUTOSAVE.XLA

   ADDINFNS.XLA

   ANALYSF.XLA

   ANALYSIS.XLA

   QE.XLA

This error message appears two times for each of the files listed above

that are selected in the Add-Ins dialog box. Additionally, when the Add-Ins

dialog box appears, the add-in that corresponds to the file listed in the

error message does not appear in the Add-Ins Available list.

CAUSE

=====

This behavior occurs when you install Microsoft Excel using the Microsoft

Office version 4.3c-CD Setup program. The behavior occurs when you load one

of the add-ins listed above using the Add-Ins dialog box, close Microsoft

Excel, and then start Microsoft Excel again. The error message does not

occur until you choose Add-Ins from the Tools menu in the second session of

Microsoft Excel.

WORKAROUNDS

===========

To work around this problem, do the following:

Note that the following steps assume that you have received the error

message described above. If you receive the error message above, the

information necessary for loading the add-in is removed from the EXCEL5.INI

file when you close Microsoft Excel. Steps 1-4 below are necessary in order

for the add-in file to be referenced in the EXCEL5.INI file again.

1. Close Microsoft Excel, and then start Microsoft Excel again.

2. From the Tools menu, choose Add-Ins.

3. In the list of Add-ins Available, select the check box next to any

   add-ins that you want to load, and choose OK.

4. Close Microsoft Excel.

5. In Notepad, or in another text editor, open the EXCEL5.INI file (located

   in your Microsoft Windows directory) and add the /F or /R switch to

   the appropriate add-in lines in the [Microsoft Excel] section as in

   the following example

      OPEN=/F C:\MSOFFICE\EXCEL\LIBRARY\ANALYSIS\ATPVBAEN.XLA

      OPEN1=/F /R C:\MSOFFICE\EXCEL\LIBRARY\AUTOSAVE.XLA

      OPEN2=/F C:\MSOFFICE\EXCEL\LIBRARY\ADDINFNS.XLA

      OPEN3=/F C:\MSOFFICE\EXCEL\LIBRARY\ANALYSIS\ANALYSF.XLA

      OPEN4=/F C:\MSOFFICE\EXCEL\LIBRARY\ANALYSIS\ANALYSIS.XLA

      OPEN5=/F /R C:\MSOFFICE\EXCEL\LIBRARY\MSQUERY\QE.XLA

   where C:\MSOFFICE\EXCEL is the directory to which you installed

   Microsoft Excel. Note that the number following the OPEN command may

   be different in your EXCEL5.INI file.

MORE INFORMATION

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

When the above error occurs, if you attempt to add the add-in file (listed

in the error message) during the same Microsoft Excel session, you receive

the following error message:

   Cannot access '<FILENAME.XLA>'

If you choose Cancel, you receive the following error message:

   '<FILENAME.XLA>' is not a valid add-in

The following table lists the add-in files that cause this problem and

their corresponding add-in name listed in the Add-Ins dialog box.

   Filename                            Add-In

   --------------------------------------------------------

   ATPVBAEN.XLA                 Analysis ToolPak - VBA

   AUTOSAVE.XLA                       AutoSave

   ADDINFNS.XLA             MS Excel 4.0 Add-in Functions

   ANALYSF.XLA              MS Excel 4.0 Analysis Functions

   ANALYSIS.XLA             MS Excel 4.0 Analysis Tools

   QE.XLA                            Q+E Add-In

For more information about using switches in the Microsoft Excel .INI file,

please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID:  Q100615

   TITLE     : Excel: Using the /F Switch to Load Add-in Macros

KBCategory: kbsetup kbtool

KBSubcategory: xlwin

Additional reference words: 4.30c-CD 5.00c


XL: Find Feature does Not Work on Filtered List

Article ID: Q127060

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, version 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

--------------------------------------------------------------------

SYMPTOMS

========

If Microsoft Excel, if you filter a database using either the AutoFilter

feature or the Advanced Filter (with filtering in-place) feature, the Find

command (on the Edit menu) may not work on the filtered list. It will find

the first occurrence of the string you are trying to find, but it will not

find any other occurrences in the filtered list or on your worksheet.

WORKAROUND

==========

In order to have the Find feature work on a filtered database, you must

first select just the visible cells in the range of cells from the filtered

list in which you want to find your string. To select just the visible

cells in a filtered list:

1. Select all of the cells in the filtered list.

2. From the Edit menu, choose GoTo.

3. In the Go To dialog box, click the Special button.

4. In the Go To Special dialog box, select Visible Cells Only, and then

   click the OK button. The Find feature will now work properly.

REFERENCES

==========

"Microsoft Excel User's Guide," version 5.0, Chapter 21, "Sorting and

Filtering Data in a List"

For more information about Filtering, choose the Search button in

Help and type:

    Filtering Lists

KBCategory: kbusage

KBSubcategory:

Additional reference words: 7.00 5.00 XL5 Auto


XL: Macro to Print Notes as Separate Printout

Article ID: Q127206

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When the Notes check box on the Sheet tab in Page Setup is selected (it

contains an X), Microsoft Excel will print the document first, and then it

will print the Notes of the document. In order to print the Notes only, you

must determine the page numbers of the Notes and print those pages only.

The following is a sample Visual Basic for Applications macro you can use

to print only the Notes for each selected worksheet.

MORE INFORMATION

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

The following macro uses the Microsoft Excel 4.0 macro function

GET.DOCUMENT(50) to determine the number of pages in the document. It also

uses the function GET.DOCUMENT(51) to determine the number of pages of

Notes that will be printed. It uses these functions to determine the page

numbers to print.

Visual Basic Code Example

-------------------------

Microsoft provides examples of Visual Basic procedures for

illustration only, without warranty either expressed or implied,

including but not limited to the implied warranties of merchantability

and/or fitness for a particular purpose. This Visual Basic procedure

is provided 'as is' and Microsoft does not guarantee that it can be

used in all situations. Microsoft does not support modifications of

this procedure to suit customer requirements for a particular purpose.

Note that a line that is preceded by an apostrophe introduces a

comment in the code--comments are provided to explain what the code is

doing at a particular point in the procedure. Note also that an

underscore character (_) indicates that code continues from one line

to the next. You can type lines that contain this character as one

logical line or you can divide the lines of code and include the line

continuation character. For more information about Visual Basic for

Applications programming style, see the "Programming Style in This

Manual" section in the "Document Conventions" section of the "Visual

Basic User's Guide."

On a module sheet, type the macro below. After you create the macro, select

the worksheet that you want to print the notes for and choose Macro from

the Tools menu. Select the print_notes macro and choose Run.

Sub print_notes()

   'Get the current selected sheets

   Set MySheets = ActiveWindow.SelectedSheets

   'Loop through all sheets that are selected

   For each PrintSheet in MySheets

      PrintSheet.Select

      'Get the current setting for Notes in Page Setup

      CurrSet = ActiveSheet.PageSetup.PrintNotes

      'Set the Notes in Page Setup to True

      ActiveSheet.PageSetup.PrintNotes = True

      'Get the number of pages to print without notes

      NumPages = ExecuteExcel4Macro("Get.Document(50)")

      'Get the number of pages of notes that will print

      NotesPages = ExecuteExcel4Macro("Get.Document(51)")

      'Print only the notes pages

      If NotesPages > 0 Then

         ActiveWindow.SelectedSheets.PrintOut _

         From:=NumPages + 1, To:=NumPages + NotesPages

         'Reset the Notes setting in Page Setup

         ActiveSheet.PageSetup.PrintNotes = CurrSet

      End If

   Next

   'Regroup the sheets

   MySheets.Select

End Sub

For more information about Notes, choose the Search button in Help and

type:

     Notes

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q112221

   TITLE     : Printing Cell Notes as Separate Printout

REFERENCES

==========

"User's Guide," version 5.0, page 676

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 seperate


XL: Macrofun.exe File Is Available for Download on CompuServe

Article ID: Q128185

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

To display help topics for Microsoft Excel 4.0 macro functions, you must

first install the complete Macro Function help file. You can obtain the

complete Macro Function help file (Macrofun.hlp), from CompuServe or

from the The Microsoft Network.

You can download this self-extracting file from the following services:

 - CompuServe

      GO MSL

      Search for Macrofun.exe or S15536

      Display results and download

 - Microsoft Download Service (MSDL)

      Dial (206) 936-6735 to connect to MSDL

      Download Macrofun.exe

 - Internet (anonymous FTP)

      ftp ftp.microsoft.com

      Change to the Softlib/Mslfiles directory

      Get Macrofun.exe

MORE INFORMATION

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

For additional information, please see the following article(s) in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q134407

   TITLE     : XL7: Can't Run Solver Help, Receive Error About Macrofun.hlp

KBCategory: kbfile kbprg

KBSubcategory: xlwin

Additional reference words: 7.00


XL7 Patch Available: 15-Digit Number, Linking, and Transpose

Article ID: Q128650

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

A patch for Microsoft Excel for Windows 95 is currently available from

Microsoft Product Support Services (PSS). The patch corrects the following

three problems:

 - The value of certain 15-digit numbers may change unexpectedly.

   For additional information, please see the following article(s) in the

   Microsoft Knowledge Base:

      ARTICLE-ID: Q137527

      TITLE     : XL: Value of 15-Digit Numbers May Be Changed Unexpectedly

 - A link from one sheet to the same cell or range in another sheet in the

   same workbook is not updated automatically.

   For additional information, please see the following article(s) in the

   Microsoft Knowledge Base:

      ARTICLE-ID: Q137710

      TITLE     : XL7: Links to Other Sheets in Workbook Not Recalculated

 - Microsoft Excel becomes unstable when you transpose a range that

   contains a reference.

   For additional information, please see the following article(s) in the

   Microsoft Knowledge Base:

      ARTICLE-ID: Q139166

      TITLE     : XL7: Excel Hangs When You Save a Pasted Transposed SUM()

The patch, which is for use only with Microsoft Excel 7.0, modifies

Microsoft Excel so that the above problems no longer occur. A separate

patch is available for Microsoft Excel 5.0c.

   For additional information, please see the following article(s) in the

   Microsoft Knowledge Base:

      ARTICLE-ID: Q128332

      TITLE     : WE1254: 15-Digit Number Patch for MS Excel Version 5.0c

TO OBTAIN THE PATCH

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

You can find XL15link.exe, a self-extracting file, on the following

electronic services:

 - On The Microsoft Network, you can find XL15link.exe in the Microsoft

   Software Library. To access the Microsoft Software Library, click Go To

   on the Edit menu, and then click Other Location. Type "mssupport"

   (without the quotation marks). Double-click the MS Software Library

   icon, and then double-click the following items:

      MS Office Software Library\MS Excel Software Library

 - On CompuServe, GEnie, and Microsoft Partner Network (MSPN), you can find

   XL15link.exe in the Microsoft Software Library by searching on the

   word XL15link, the Q number of this article, or S15576.

   XL15link.exe is a compressed, self-extracting file. After you download

   XL15link.exe, double-click it to extract the contents of the file.

 - XL15link.exe is available by modem from the Microsoft Download Service

   (MSDL), which you can reach by calling (206) 936-6735. This service is

   available 24 hours a day, 7 days a week. The highest download speed

   available is 14,400 bits per second (bps). For more information about

   using the MSDL, call (800) 936-4100 and follow the prompts. XL15link.exe

   is a compressed, self-extracting file. After you download XL15link.exe,

   double-click it to extract the contents of the file.

 - On the Internet, files are located on the Microsoft anonymous ftp

   server, which you can reach by typing the following at the ">" prompt:

      ftp ftp.microsoft.com

   To download XL15link.exe, change to the Softlib/Mslfiles directory

   and type the following at the ">" prompt:

      Get XL15link.exe

If you are unable to access the source(s) listed above, you can have the

patch, part number 065-054-S61, mailed to you by calling Microsoft Product

Support Services Monday through Friday, 6:00 A.M. to 6:00 P.M. Pacific time

at (206) 635-7070. If you are outside the United States, contact the

Microsoft subsidiary for your area. To locate your subsidiary, call the

Microsoft International Sales Information Center at (206) 936-8661.

TO INSTALL THE PATCH

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

This procedure assumes that you have already downloaded and extracted the

compressed file.

1. At the MS-DOS prompt, type the following and press ENTER

      copy <source>:\*.* <location>

   where <source> is either the letter of your floppy disk drive or

   the folder (directory) containing the file you downloaded from

   online services, and <location> is the path to your Microsoft Excel

   folder. For example, if you are copying the file from a floppy disk

   that you inserted in drive A, and C:\Excel is the path to your

   Excel folder, type:

      copy a:\*.* c:\excel

   Or, for example, if you downloaded the XL15link.exe file from online

   services to C:\Dnload, and C:\Excel is the path to your Microsoft

   Excel folder, type:

      copy c:\dnload\*.* c:\excel

   The following files are copied to your Microsoft Excel folder:

      Patchxl.exe        25,600  10-19-95  2:26a

      Readme.txt         9,405  10-25-95  5:13p

2. Quit Microsoft Excel if it is running.

3. In Windows Explorer, double-click the Patchxl.exe file in your Microsoft

   Excel folder.

   When the patch has completed modifying Microsoft Excel, a message

   appears.

KBCategory: kbusage kbprb kbfile

KBSubcategory: xlwin

Additional reference words: 7.00 patch


XL: Range Command in Macro Selects Cells from Entire Range

Article ID: Q133139

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

When you are using Visual Basic for Applications to work with a filtered

list, range commands will select cells from the entire current range, not

just from the visible cells as might be expected.

MORE INFORMATION

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

The following are two examples of Visual Basic code. One example selects

all the visible cells in a filtered list and treats them as a selection,

while the other selects specific visible cells for the purpose of cell

manipulation.

Microsoft provides examples of Visual Basic procedures for illustration

only, without warranty either expressed or implied, including but not

limited to the implied warranties of merchantability and/or fitness for a

particular purpose. This Visual Basic procedure is provided 'as is' and

Microsoft does not guarantee that it can be used in all situations.

Microsoft does not support modifications of this procedure to suit customer

requirements for a particular purpose.

To select all the visible cells in a filtered list

--------------------------------------------------

Note that while this method is acceptable for modifying or copying all the

cells in a selection, it does not provide a way to address specific cells

in a filtered list.

1. Use the following steps to set up a filtered list on a worksheet:

   a. In a new worksheet, enter the following values:

      A1: Value A  B1: Value B  C1: Value C

      A2: A-2      B2: B-2      C2: C-2

      A3: A-3      B3: B-3      C3: C-3

      A4: A-4      B4: B-4      C4: C-4

      A5: A-5      B5: B-5      C5: C-5

      A6: A-6      B6: B-6      C6: C-6

      A7: A-7      B7: B-7      C7: C-7

      A8: A-8      B8: B-8      C8: C-8

      A9: A-9      B9: B-9      C9: C-9

      A10: A-10    B10: B-10    C10: C10

   b. While holding down the CTRL key, use the mouse to select rows 3, 4,

      6, 7, 8, and 10.

   c. On the Format menu, click Row, and then click Hide.

   At this point, only the Header row and rows 2, 5, and 9 should be

   visible.

2. Enter the following Visual Basic for Applications code on a module

   sheet.

   ' The following Visual Basic for Applications code provides the ability

   ' to select all of the visible cells in the current region based on a

   ' single cell (similar to the way sort works); it allows you to copy

   ' only the visible cells to another worksheet.

   Sub Select_All_Visible_Cells()

      'Select all cells that have a "visible" property.

      Range("A1").CurrentRegion.SpecialCells(xlVisible).Select

      'Copy the visible cells to worksheet named "Sheet2."

      Selection.Copy Worksheets("Sheet2").Range("A1")

   End Sub

To select specific cells in a filtered list

-------------------------------------------

The first step in selecting a specific cell in a filtered list is to

determine which rows are visible and which rows are hidden. You can then

select specific cells in the visible row.

1. To create a list, follow step 1 in the "To select all the visible cells

   in a filtered list" section above.

2. Enter the following Visual Basic code on a module sheet.

   Sub Select_Specific_Visible_Cells()

      '   Area is set as an object that defines the Current Region.

      '   Current Region contains all the cells starting at the cell

      '   defined in the Range Method and bounded by blank rows and blank

      '   columns (or the edges of the worksheet).

      Set area = Range("A1").CurrentRegion

      '   LastColumn is the column number for the last column in the

      '   Current Region.

      lastcolumn = area.Columns.Count

      '   EndRow is set as an object that contains all the cells in the

      '   last row (the last record) in Current Region.

      Set endrow = area.Offset(area.Rows.Count - 1).Resize(1, lastcolumn)

      '   SearchRow is set as an object that contains the first row in the

      '   current region.

      Set searchrow = area.Resize(1, lastcolumn)

      '   The outside "Do Until" loop allows us to look at each row, one

      '   row at a time until we reach the end of the Current Region.

      Do Until searchrow.Row >= endrow.Row

      '   The inside "Do" loop locates the next visible.(not hidden) row.

         Do

      '   Verify we didn't select past the end of the Current Region.

            If searchrow.Row < endrow.Row Then

      '   If OK then select the next row to be checked.

               Set searchrow = searchrow.Offset(1)

            Else

      '   If the selection goes past the end of Current Region, exit the

      '   sub.

               Exit Sub

            End If

      '   Continue to look until a row is found that's not hidden.

         Loop Until searchrow.EntireRow.Hidden = False

      '   Select the visible row.

      searchrow.Select

      '   The "For Each" loop allows you to look at, copy, modify, and so

      '   on, each cell in the visible row. "MsgBox" then displays each

      '   cell's value.

         For Each Cell In Selection

            MsgBox Cell.Value

         Next

      '   Once we process a visible row, loop back and look for another.

      Loop

   End Sub

In this example, the Message Box displays the contents of each of the three

cells in each of the visible rows 2, 5, and 9. The "For Each Cell In

Selection" could be replaced with the Range Cells method to select specific

cells from the selected visible rows.

REFERENCES

==========

"Visual Basic User's Guide," version 5.0, Chapter 5, "The Range Object,"

pages 82-84

KBCategory: kbprg kbcode

KBSubcategory:

Additional reference words: 7.00 5.00 5.00c


XL7: AutoCalculate Not Available on Macro Sheet

Article ID: Q133415

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SUMMARY

=======

The AutoCalculate feature is not available in a Microsoft Excel 4.0 macro

sheet. This behavior is by design.

MORE INFORMATION

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

With Autocalculate, you do not need to use a calculator or enter temporary

formulas on a worksheet when you want to quickly check a total. Now you can

just select the range you want to sum, and the answer will appear in the

status bar at the bottom of the screen. You can also average the selected

numbers or count the entries by clicking the AutoCalculate area in the

status bar with the right mouse button.

KBCategory: kbusage

KBSubcategory: xlwin

Additional reference words: 7.00 7.00


XL: DefType Statements Change If Workbook Used on New Platform

Article ID: Q134412

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows, versions 5.0, 5.0c

 - Microsoft Excel for Windows NT, version 5.0

 - Microsoft Excel for the Macintosh, versions 5.0, 5.0a

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

SYMPTOMS

========

When you transfer a Microsoft Excel workbook from the Windows platform to

the Macintosh platform, or vice versa, any DefType statements that are

contained within a Visual Basic module in the workbook may be changed

arbitrarily or may disappear completely.

WORKAROUND

==========

To avoid this problem, use apostrophes to comment out any DefType

statements in your code before you transfer the workbook to a different

platform (Windows or Macintosh). Once the file has been transferred, you

can remove the apostrophes from the DefType statements, and your code

should behave as expected.

For more information about comments in Visual Basic Code,

click the Index tab in Microsoft Excel Help, type the following text

   Comments, Visual

double-click the selected text, and then click Colors And Capitalization.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft products

listed at the beginning of this article. We are researching this problem

and will post new information here in the Microsoft Knowledge Base as it

becomes available.

MORE INFORMATION

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

Microsoft Excel includes the following DefType statements:

   DefBool   DefInt    DefLng   DefCur   DefSng

   DefDbl    DefDate   DefStr   DefObj   DefVar

DefType statements are used to declare that all variables whose names begin

with a certain letter (or letters) are of a certain type. For example, this

statement

   DefBool A

declares that all variables whose names begin with the letter "A" or "a"

are Boolean variables, unless they are explicitly declared otherwise.

If you transfer a workbook that contains such statements from the Windows

platform to the Macintosh platform, or vice versa, DefType statements

contained in the workbook may change arbitrarily or may disappear

completely. For example, if you create a workbook in Microsoft Excel for

Windows that contains the DefType statements shown in the left column of

the following table, and you then transfer that file to Microsoft Excel for

the Macintosh, the DefType statements will probably resemble those

statements shown in the right column of the table:

   Original platform         New platform

   --------------------------------------

   DefBool A                 DefBool Q

   DefInt B                  DefInt R

   DefLng C                  DefLng S

   DefCur D                  DefCur T

   DefSng E                  DefSng U

   DefDbl F                  DefDbl V

   DefDate G                 DefDate W

   DefStr H                  DefStr X

   DefObj I                  DefObj Y

   DefVar J                  DebVar Z

   DefBool K

   DefInt L

   DefLng M

   DefCur N

   DefSng O

   DefDbl P

   DefDate Q                 DefDate A

   DefStr R                  DefStr B

   DefObj S                  DefObj C

   DefVar T                  DefVar D

Some DefType statements are changed to refer to a different letter, while

others disappear completely. This may prevent code in your workbook from

being executed correctly.

The results are the same whether you transfer a workbook from the Windows

platform to the Macintosh platform or from the Macintosh platform to the

Windows platform.

KBCategory: kbprg kbenv

KBSubcategory:

Additional reference words: 7.00 5.00 5.00a 5.00c 7.00 integer long

currency

single double date string object variant arbitrary arbitrarily copy


FastTips: "Printing Questions and Answers" (WE1209)

Article ID: Q135833

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

This article contains the text of "WE1209: Printing Questions and Answers,"

which is available on the Microsoft FastTips service for Desktop

Applications. To access this service, call (800) 936-4100.

You can obtain this Application Note from the following sources:

 - CompuServe, GEnie, and Microsoft Partner Network (MSPN)

 - Microsoft Download Service (MSDL)

 - The Internet (Microsoft anonymous ftp server)

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note" section

at the end of this article.

THE TEXT OF WE1209

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

                WE1209: PRINTING QUESTIONS AND ANSWERS

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

                                                   Revision Date: 8/95

                                                      No Disk Included

The following information applies to Microsoft Excel for Windows(R)

95, version 7.0.

---------------------------------------------------------------------

 INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY

 ACCOMPANY THIS DOCUMENT (collectively referred to as an Application

 Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER

 EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

 WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR

 PURPOSE. The user assumes the entire risk as to the accuracy and

 the use of this Application Note. This Application Note may be

 copied and distributed subject to the following conditions:  1) All

 text must be copied without modification and all pages must be

 included;  2) If software is included, all files on the disk(s)

 must be copied without modification (the MS-DOS(R)  utility

 diskcopy is appropriate for this purpose);  3) All components of

 this Application Note must be distributed together;  and  4) This

 Application Note may not be distributed for profit.

 Copyright (C) 1995 Microsoft Corporation.  All Rights Reserved.

 Microsoft, MS-DOS, and Windows are registered trademarks of

 Microsoft Corporation.

---------------------------------------------------------------------

1.  Q. Why is my Microsoft Excel for Windows 95 worksheet being

       printed without gridlines?

    A. In Microsoft Excel, when you create a new worksheet and print

       it, the worksheet is printed without gridlines by default.

       However, when you open a worksheet or workbook that was created

       in an earlier version of Microsoft Excel, the file behaves as

       it did in the earlier version; that is, the file is printed and

       displayed in print preview with gridlines if it was printed

       with gridlines in the earlier version of Microsoft Excel. For

       more information about this issue, please order the item number

       Q129445 from the FastTips Catalog.

2.  Q. How can I get my Microsoft Excel for Windows 95 document to be

       printed with gridlines?

    A. To print your worksheet with gridlines, use the following three

       steps:

       1. On the File menu, click Page Setup, and then click the Sheet

          tab.

       2. Under Print, select the Gridlines check box.

       3. Click OK.

       For information about other ways to automatically turn on

       gridlines, order item number Q129445 from the FastTips Catalog.

--------------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

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

 - On CompuServe, GEnie, and Microsoft Partner Network (MSPN), Application

   Notes are located in the Microsoft Software Library. You can find WE1209

   in the Software Library by searching on the word WE1209, the Q number of

   this article, or S15513. WE1209.txt is a compressed, self-extracting

   file. After you download WE1209.txt, double-click it to extract the

   contents of the file.

 - Application Notes are available by modem from the Microsoft Download

   Service (MSDL), which you can reach by calling (206) 936-6735. This

   service is available 24 hours a day, 7 days a week. The highest download

   speed available is 14,400 bits per second (bps). For more information

   about using the MSDL, call (800) 936-4100 and follow the prompts. To

   obtain WE1209, download WE1209.txt. WE1209.txt is a compressed, self-

   extracting file. After you download WE1209.txt, double-click it to

   extract the contents of the file.

 - On the Internet, Application Notes are located on the Microsoft

   anonymous ftp server, which you can reach by typing the following at the

   ">" prompt:

      ftp ftp.microsoft.com

   To download WE1209.txt, change to the Softlib/Mslfiles directory

   and type the following at the ">" prompt:

      Get WE1209.txt

  - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call 24

   hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can have

   this Application Note mailed or faxed to you by calling Microsoft

   Product Support Services Monday through Friday, 6:00 A.M. to 6:00 P.M.

   Pacific time at (800) 635-7070. If you are outside the United States,

   contact the Microsoft subsidiary for your area. To locate your

   subsidiary, call the Microsoft International Sales Information Center at

   (206) 936-8661.

KBCategory: kbprint kusage kbfasttip

KBSubcategory: xlwin

Additional reference words: 7.00


FastTips: "Upgrading Questions and Answers" (WE1207)

Article ID: Q135834

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

This article contains the text of "WE1207: Upgrading Questions and

Answers," which is available on the Microsoft FastTips service for Desktop

Applications. To access this service, call (800) 936-4100.

You can obtain this Application Note from the following sources:

 - CompuServe, GEnie, and Microsoft Partner Network (MSPN)

 - Microsoft Download Service (MSDL)

 - The Internet (Microsoft anonymous ftp server)

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note" section

at the end of this article.

THE TEXT OF WE1207

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

                WE1207: UPGRADING QUESTIONS AND ANSWERS

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

                                                   Revision Date: 8/95

                                                      No Disk Included

The following information applies to Microsoft Excel for Windows(R)

95, version 7.0.

---------------------------------------------------------------------

 INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY

 ACCOMPANY THIS DOCUMENT (collectively referred to as an Application

 Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER

 EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

 WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR

 PURPOSE. The user assumes the entire risk as to the accuracy and

 the use of this Application Note. This Application Note may be

 copied and distributed subject to the following conditions:  1) All

 text must be copied without modification and all pages must be

 included;  2) If software is included, all files on the disk(s)

 must be copied without modification (the MS-DOS(R)  utility

 diskcopy is appropriate for this purpose);  3) All components of

 this Application Note must be distributed together;  and  4) This

 Application Note may not be distributed for profit.

 Copyright (C) 1995 Microsoft Corporation.  All Rights Reserved.

 Microsoft, MS-DOS, PivotTable, Visual Basic, and Windows are

 registered trademarks and Windows NT is a trademark of Microsoft

 Corporation.

---------------------------------------------------------------------

1.  Q. What are the new features in Microsoft Excel for Windows 95?

    A. The new features in Microsoft Excel for Windows 95 include

        - Answer Wizard

        - AutoCalculate

        - AutoComplete

        - AutoCorrect

        - AutoFilter with Top Ten

        - Improved drag-and-drop editing

        - CellTips and ScrollTips

        - Data Map

        - Easier document retrieval and management

        - Easier number formatting

        - Shared lists

        - Templates and the Template Wizard

       For additional information about these new features, order item

       number Q130490 from the FastTips Catalog. Note that this

       information is also available in the "What's New" book in

       Microsoft Excel online Help.

2.  Q. What are the minimum system requirements for running Microsoft

       Excel for Windows 95?

    A. The minimum hardware and software requirements for running

       Microsoft Excel for Windows 95 are the following:

        - A personal computer with a 386DX or higher processor (486

          recommended).

        - Microsoft Windows 95 operating system or Microsoft Windows

          NT(TM) Workstation operating system version 3.51 or later

          (will not run on earlier versions of Windows).

        - 6 megabytes (MB) of memory for use on Windows 95 or 12 MB of

          memory for use on a Windows NT workstation.

        - Hard disk space required: 8 MB for a Compact installation;

          18 MB for a Typical installation; 38 MB (maximum) for a

          Custom installation.

        - One 3.5-inch high-density disk drive.

        - A VGA- or higher-resolution video adapter (SVGA 256-color

          recommended).

        - Microsoft Mouse or compatible pointing device.

       Optional hardware and software items include:

        - Windows-compatible network.

        - Windows-compatible printer.

        - 2400- or higher-baud modem (9600-baud modem recommended).

        - Audio board with headphones or speakers.

3.  Q. What new analysis tools does Microsoft Excel for Windows 95

       provide?

    A. In addition to the list management, charting, and PivotTable(R)

       analysis tools currently found in Microsoft Excel, we have

       provided additional tools and enhanced the most commonly used

       tools. For example, shared lists allow multiple users to add

       and analyze data in the same file at the same time. For instant

       data analysis, AutoCalculate provides a running sum, average,

       or count of currently highlighted cells.

4.  Q. Does Microsoft Excel for Windows 95 use multiple threads?

    A. No. After careful evaluation, it was decided that Microsoft

       Excel would not benefit from multi-threading--in fact, we

       determined that this functionality would actually slow down the

       recalculation speed on a single-processor machine.

       Consequently, we focused our development efforts on rewriting

       the recalculation engine. In some cases, this redesigned engine

       results in a 50-percent increase in calculation speed.

5.  Q. Will I be able to use my Microsoft Excel version 5.0 Visual

       Basic(R), Applications Edition, modules in Microsoft Excel for

       Windows 95?

    A. Yes. In most cases, you will be able to use your Visual

       Basic modules in Microsoft Excel for Windows 95. However, if

       you create advanced macros that make calls to the Windows API,

       these macros will be affected by the switch to Windows 95. For

       more information about this issue, order item number Q131525

       from the FastTips Catalog.

--------------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

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

 - On CompuServe, GEnie, and Microsoft Partner Network (MSPN), Application

   Notes are located in the Microsoft Software Library. You can find WE1207

   in the Software Library by searching on the word WE1207, the Q number of

   this article, or S15511. WE1207.exe is a compressed, self-extracting

   file. After you download WE1207.exe, double-click it to extract the

   contents of the file.

 - Application Notes are available by modem from the Microsoft Download

   Service (MSDL), which you can reach by calling (206) 936-6735. This

   service is available 24 hours a day, 7 days a week. The highest download

   speed available is 14,400 bits per second (bps). For more information

   about using the MSDL, call (800) 936-4100 and follow the prompts. To

   obtain WE1207, download WE1207.exe. WE1207.exe is a compressed, self-

   extracting file. After you download WE1207.exe, double-click it to

   extract the contents of the file.

- On the Internet, Application Notes are located on the Microsoft

   anonymous ftp server, which you can reach by typing the following at the

   ">" prompt:

      ftp ftp.microsoft.com

   To download WE1207.exe, change to the Softlib/Mslfiles directory

   and type the following at the ">" prompt:

      Get WE1207.exe

  - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call 24

   hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can have

   this Application Note mailed or faxed to you by calling Microsoft

   Product Support Services Monday through Friday, 6:00 A.M. to 6:00 P.M.

   Pacific time at (800) 635-7070. If you are outside the United States,

   contact the Microsoft subsidiary for your area. To locate your

   subsidiary, call the Microsoft International Sales Information Center at

   (206) 936-8661.

KBCategory: kusage kbfasttip kbfile

KBSubcategory: xlwin

Additional reference words: 7.00


FastTips: "Basic Use Questions and Answers" (WE1208)

Article ID: Q135836

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

This article contains the text of "WE1208: Basic Use Questions and

Answers," which is available on the Microsoft FastTips service for Desktop

Applications. To access this service, call (800) 936-4100.

You can obtain this Application Note from the following sources:

 - CompuServe, GEnie, and Microsoft Partner Network (MSPN)

 - Microsoft Download Service (MSDL)

 - The Internet (Microsoft anonymous ftp server)

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note" section

at the end of this article.

THE TEXT OF WE1208

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

                WE1208: BASIC USE QUESTIONS AND ANSWERS

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

                                                   Revision Date: 8/95

                                                      No Disk Included

The following information applies to Microsoft Excel for Windows(R)

95, version 7.0.

---------------------------------------------------------------------

 INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY

 ACCOMPANY THIS DOCUMENT (collectively referred to as an Application

 Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER

 EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

 WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR

 PURPOSE. The user assumes the entire risk as to the accuracy and

 the use of this Application Note. This Application Note may be

 copied and distributed subject to the following conditions:  1) All

 text must be copied without modification and all pages must be

 included;  2) If software is included, all files on the disk(s)

 must be copied without modification (the MS-DOS(R)  utility

 diskcopy is appropriate for this purpose);  3) All components of

 this Application Note must be distributed together;  and  4) This

 Application Note may not be distributed for profit.

 Copyright (C) 1995 Microsoft Corporation.  All Rights Reserved.

 Microsoft, MS-DOS, Visual Basic, and Windows are registered

 trademarks and Windows NT is a trademark of Microsoft Corporation.

---------------------------------------------------------------------

1.  Q. Why can't I run Microsoft Excel version 5.0 for Windows NT(TM)

       and Microsoft Excel for Windows 95 on the same computer?

    A. Due to internal differences in the 32-bit Visual Basic(R) for

       Applications library files needed to run these two versions of

       Microsoft Excel, it is not possible for both versions of

       Microsoft Excel to reside on the same computer. For more

       information about this issue, please order item number Q131299

       from the FastTips Catalog.

2.  Q. Why do files that I created in Microsoft Excel version 5.0

       increase in size by 4-6K when I open them in Microsoft Excel

       for Windows 95? This happens even if I add no additional

       information to the file.

    A. This behavior occurs in part because Microsoft Excel for

       Windows 95 has been optimized to save files faster than

       Microsoft Excel version 5.0. Note, also, that when you create

       and save a file in Microsoft Excel for Windows 95, the file is

       not necessarily larger than the equivalent file that you create

       and save in Microsoft Excel version 5.0. For more information

       about this issue, please order item number Q132454 from the

       FastTips Catalog.

3.  Q. When I try to use zip codes to create a map object in Microsoft

       Data Map, I receive an error message. Why is this happening?

    A. When you create a map object based on zip codes, you must

       format the zip codes with the special Zip Code number format.

       For more information about formatting cells with the Zip Code

       format, please order item number Q131929 from the FastTips

       Catalog.

4.  Q. In versions of Microsoft Excel earlier than version 7.0, when I

       type a value with a percent sign or format a value with a

       Percentage number format, the value is displayed in the formula

       bar in decimal format. However, in Microsoft Excel for Windows

       95, when I type a value with a percent sign, the value in the

       formula bar is displayed with the percent sign. Why does this

       happen?

    A. This new behavior makes it easier for you to enter a new value

       in a cell that is formatted with the Percentage number format.

       For example, in earlier versions of Microsoft Excel, when you

       enter the value 0.41 on your worksheet and format the cell with

       the Percentage number format, the value is displayed as 41%. If

       you then enter the value 56 in that same cell, the value is

       displayed as 5600%, instead of 56% as you may have intended.

       For more information about this issue, order item number

       Q129253 from the FastTips Catalog.

5.  Q. Why are my Microsoft Excel documents being saved in the "My

       Documents" folder?

    A. By default, all Microsoft Office applications are saved in the

       "My Documents" folder. To change the default directory for

       Microsoft Excel, use the following three steps:

       1. In Microsoft Excel, on the Tools menu, click Options.

       2. Click the General tab.

       3. In the Default File Location box, type the path to the new

          default directory.

--------------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

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

 - On CompuServe, GEnie, and Microsoft Partner Network (MSPN), Application

   Notes are located in the Microsoft Software Library. You can find WE1208

   in the Software Library by searching on the word WE1208, the Q number of

   this article, or S15512. WE1208.exe is a compressed, self-extracting

   file. After you download WE1208.exe, double-click it to extract the

   contents of the file.

 - Application Notes are available by modem from the Microsoft Download

   Service (MSDL), which you can reach by calling (206) 936-6735. This

   service is available 24 hours a day, 7 days a week. The highest download

   speed available is 14,400 bits per second (bps). For more information

   about using the MSDL, call (800) 936-4100 and follow the prompts. To

   obtain WE1208, download WE1208.exe. WE1208.exe is a compressed, self-

   extracting file. After you download WE1208.exe, double-click it to

   extract the contents of the file.

 - On the Internet, Application Notes are located on the Microsoft

   anonymous ftp server, which you can reach by typing the following at the

   ">" prompt:

      ftp ftp.microsoft.com

   To download WE1208.exe, change to the Softlib/Mslfiles directory

   and type the following at the ">" prompt:

      Get WE1208.exe

  - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call 24

   hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can have

   this Application Note mailed or faxed to you by calling Microsoft

   Product Support Services Monday through Friday, 6:00 A.M. to 6:00 P.M.

   Pacific time at (800) 635-7070. If you are outside the United States,

   contact the Microsoft subsidiary for your area. To locate your

   subsidiary, call the Microsoft International Sales Information Center at

   (206) 936-8661.

KBCategory: kusage kbfasttip kbfile

KBSubcategory: xlwin

Additional reference words: 7.00


FastTips: "Shared Documents Questions and Answers" (WE1210)

Article ID: Q135837

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Excel for Windows 95, version 7.0

--------------------------------------------------------------------

This article contains the text of "WE1210: Working with Shared Documents

Questions and Answers," which is available on the Microsoft FastTips

service for Desktop Applications. To access this service, call (800) 936-

4100.

You can obtain this Application Note from the following sources:

 - CompuServe, GEnie, and Microsoft Partner Network (MSPN)

 - Microsoft Download Service (MSDL)

 - The Internet (Microsoft anonymous ftp server)

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note" section

at the end of this article.

THE TEXT OF WE1210

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

      WE1210: WORKING WITH SHARED DOCUMENTS QUESTIONS AND ANSWERS

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

                                                   Revision Date: 8/95

                                                      No Disk Included

The following information applies to Microsoft Excel for Windows(R)

95, version 7.0.

---------------------------------------------------------------------

 INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY

 ACCOMPANY THIS DOCUMENT (collectively referred to as an Application

 Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER

 EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

 WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR

 PURPOSE. The user assumes the entire risk as to the accuracy and

 the use of this Application Note. This Application Note may be

 copied and distributed subject to the following conditions:  1) All

 text must be copied without modification and all pages must be

 included;  2) If software is included, all files on the disk(s)

 must be copied without modification (the MS-DOS(R)  utility

 diskcopy is appropriate for this purpose);  3) All components of

 this Application Note must be distributed together;  and  4) This

 Application Note may not be distributed for profit.

 Copyright (C) 1995 Microsoft Corporation.  All Rights Reserved.

 Microsoft, MS-DOS, and Windows are registered trademarks of

 Microsoft Corporation.

---------------------------------------------------------------------

1.  Q. Is there a limit to the number of users that can work on one

       shared list at one time?

    A. No. There is no limit to the number of users that can work on a

       shared list at one time.

2.  Q. With the shared list feature, what happens if two users enter

       data into the same cell at the same time?

    A. Microsoft Excel has built-in functionality to handle such a

       conflict if it occurs. The Conflict Resolution dialog box will

       display the following information:

        - The values that were entered simultaneously

        - Where on the sheet these values are located

        - When the values were entered

        - Who entered each value

       This information allows you to choose which value you want to

       use. Microsoft Excel also displays a status log that shows each

       conflict along with its resolution.

3.  Q. How are changes updated in a shared list?

    A. When you work with a shared list, changes from other users are

       not added until one of the people using the list clicks the

       Save command.

4.  Q. When I use a shared list, the Note command on the Insert menu

       is available. However, when I click Note, and type a note,

       nothing happens. Why can't I insert a cell note in the

       worksheet?

    A. You cannot insert a cell note in a worksheet when you are using

       a shared workbook. For more information about this issue, order

       item number Q131552 from the FastTips Catalog. For information

       about other features that are unavailable when you are using a

       shared list, order item number Q130560 from the FastTips

       Catalog.

--------------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

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

 - On CompuServe, GEnie, and Microsoft Partner Network (MSPN), Application

   Notes are located in the Microsoft Software Library. You can find WE1210

   in the Software Library by searching on the word WE1210, the Q number of

   this article, or S15514. WE1210.exe is a compressed, self-extracting

   file. After you download WE1210.exe, double-click it to extract the

   contents of the file.

- Application Notes are available by modem from the Microsoft Download

   Service (MSDL), which you can reach by calling (206) 936-6735. This

   service is available 24 hours a day, 7 days a week. The highest download

   speed available is 14,400 bits per second (bps). For more information

   about using the MSDL, call (800) 936-4100 and follow the prompts. To

   obtain WE1210, download WE1210.exe. WE1210.exe is a compressed, self-

   extracting file. After you download WE1210.exe, double-click it to

   extract the contents of the file.

 - On the Internet, Application Notes are located on the Microsoft

   anonymous ftp server, which you can reach by typing the following at the

   ">" prompt:

      ftp ftp.microsoft.com

   To download WE1210.ext, change to the Softlib/Mslfiles directory

   and type the following at the ">" prompt:

      Get WE1210.ext

  - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call 24

   hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can have

   this Application Note mailed or faxed to you by calling Microsoft

   Product Support Services Monday through Friday, 6:00 A.M. to 6:00 P.M.

   Pacific time at (800) 635-7070. If you are outside the United States,

   contact the Microsoft subsidiary for your area. To locate your

   subsidiary, call the Microsoft International Sales Information Center at

   (206) 936-8661.

KBCategory: kusage kbfasttip kbfile

KBSubcategory: xlwin

Additional reference words: 7.00


 More Information On Knowledge Base (KB) Helpfiles

Article ID: Q199990

The KB Help file is a snapshot of the Knowledge Base

written by Product Support Engineers to help

support Microsoft customers at the time this file was

created.

More recent KB articles can be found on Internet,

CompuServe, and GENIE. After you log on to one of these

services with your  account information, follow these steps

to find the KB:

 - On Internet, look in DESKAPPS\<product>\KB\README.TXT

 - On CompuServe, type "GO MSKB"

 - On GEnie, type "M 505"

<product> would be the name of the product you are seeking information on

such as Excel or Word.

OTHER SOURCES OF MICROSOFT SUPPORT INFORMATION

Microsoft offers Electronic Information Services as an

alternative to person-to-person support. All U.S. and

Canadian Microsoft customers have access 24 hours a day, 7

days a week to a range of free or low-cost service options

including:

Microsoft FastTips

Toll-free, automated information about key Microsoft

products. Customers have access to technical articles

(including common questions and answers) via voice, fax, and

U.S. Mail. The four categories are:

FastTips for Desktop Applications          (800)-936-4100

FastTips for Personal Operating Systems    (800)-936-4200

FastTips for Development Products          (800)-936-4300

FastTips for Advanced Systems              (800)-936-4400

Microsoft Knowledge Base

This is the primary Microsoft product information source--a

database of more than 50,000 detailed articles containing

technical information, bug lists, fix lists, and more.

Access via CompuServe, the Internet, and GEnie.

Microsoft Download Service

Direct access to Microsoft Download Library (MSDL) by modem

through the Microsoft BBS service at (206) 936-6735. Connect

information: 1200, 2400, or 9600 baud, no parity, 8 data

bits, and 1 stop.

Microsoft Forums on CompuServe

Microsoft facilitates a variety of interactive dialog forums

for its worldwide community of customers. Access by typing:

GO MICROSOFT. CompuServe connect charges apply. To establish

an information service account, contact CompuServe directly

at (800) 848-8199.

Microsoft Information Network

TechNet

Part of the support professionals program, the TechNet CD

contains resource kits, customer solution profiles, case

studies, and tips and techniques for integration. For

TechNet subscriptions, call (800) 344-2121 ext. 035.

Microsoft Developers' Network (MSDN)

Level 1 CD is a Development Library of comprehensive

development information for Win16 and Win32 APIs. Level 2 CD

contains all software needed to develop Windows-based

applications. For Microsoft Developers Network

subscriptions, call (800) 759-5474.

The Internet

Microsoft maintains a World Wide Web Site at www.microsoft.com; the

URL is: http://www.microsoft.com/.  Once you have reached the Web site choose

"Support for Microsoft Products", then Knowledge Base.

You may also access the Microsoft Software Library and the Microsoft

Knowledge Base by anonymous ftp. The Microsoft Internet FTP

archive host supports anonymous login. The name of the

server is FTP.MICROSOFT.COM; the IP address is

198.105.232.1.