Вы находитесь на странице: 1из 54

Summary of Select Advanced Features & Facilities of MS-Excel

URL: http://support.microsoft.com

XL: Example on Use of Solver


SUMMARY
The Solver add-in that ships with Microsoft Excel is used to find solutions to "what-if" scenarios based on adjustable cells and constraint cells. This article gives an example of how to set up a model on a worksheet and how to use Solver to find a solution to the model based on the constraints in the model. Back to the top

MORE INFORMATION
Follow these steps to create the model on a worksheet: 1. Open a new worksheet. 2. Type the following on the worksheet:

A1: 1 A2: -3 A3: A4: =A1*A3^2+A2*A3+2


3. On the Tools menu, click Solver. NOTE: If Solver is not on the Tools menu, you need to make sure the Solver add-in is listed and selected in the Add-ins dialog box. 4. In the Solver Parameters dialog box, in the Set Target Cell box, enter A4. 5. Click Value Of and set the value to 0. 6. In the By Changing Cells box, enter A3. 7. Under Subject to the Constraints, click Add. 8. Type A3 in the Cell Reference box, click ">=" in the list, and in the Constraint box, type 1.5. Click OK. 9. Click Solve. You should get the Solver Results dialog box stating that Solver found a solution and the value in cell A4 should now be 0, or very close to zero (1.04E-07, for example). Click OK to return to the worksheet.

VBA macro that uses data from a Word document and an Excel workbook to send messages from Outlook
View products that this article applies to. Article ID : 213712 Last Review : January 24, 2007 Revision : 4.1

This article was previously published under Q213712

SUMMARY
This article describes a Visual Basic for Applications macro that uses data from a Microsoft Word document and a Microsoft Excel workbook to send messages from Microsoft Outlook.

MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is

being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following example assumes that there are two defined names in the worksheet: The first defined name, "subjectcell", refers to a cell that contains the message subject line (for example, "This is a test message."). The second defined name, "tolist", refers to the first cell in the horizontal list that contains a list of recipients (for example, "John Doe", "Jane Doe", and so forth). You must also have a Microsoft Word document. The text of this document is used by the macro as the message body of your mail message.

Sub SendOutlookMessages() 'Dimension variables. Dim OL As Object, MailSendItem As Object Dim W As Object Dim MsgTxt As String, SendFile As String Dim ToRangeCounter As Variant 'Identifies Word file to send SendFile = Application.GetOpenFilename(Title:="Select MS Word " & _ "file to mail, then click 'Open'", buttontext:="Send", _ MultiSelect:=False) 'Starts Word session Set W = GetObject(SendFile) 'Pulls text from file for message body MsgTxt = W.Range(Start:=W.Paragraphs(1).Range.Start, _ End:=W.Paragraphs(W.Paragraphs.Count).Range.End) 'Ends Word session Set W = Nothing 'Starts Outlook session Set OL = CreateObject("Outlook.Application") Set MailSendItem = OL.CreateItem(olMailItem) ToRangeCounter = 0 'Identifies number of recipients for To list. For Each xCell In ActiveSheet.Range(Range("tolist"), _ Range("tolist").End(xlToRight)) ToRangeCounter = ToRangeCounter + 1 Next xCell If ToRangeCounter = 256 Then ToRangeCounter = 1 'Creates message With MailSendItem .Subject = ActiveSheet.Range("subjectcell").Text .Body = MsgTxt 'Creates "To" list For Each xRecipient In Range("tolist").Resize(1, ToRangeCounter) RecipientList = RecipientList & ";" & xRecipient Next xRecipient .To = RecipientList .Send End With 'Ends Outlook session Set OL = Nothing End Sub

Description and examples of data validation in Excel


View products that this article applies to. Article ID : 211485 Last Review : January 23, 2007 Revision : 3.2

This article was previously published under Q211485 For a Microsoft Excel 97 version of this article, see 159252. For a Microsoft Excel 98 Macintosh Edition version of this article, see 181323.

On This Page

SUMMARY MORE INFORMATION Make a List of Entries Allowed in the Cell Create a Prompt Message Explaining the Type of Data Allowed in a Cell Create a Message That Appears When Incorrect Data Is Entered Create a Stop Alert Message Create a Warning Alert Message Create an Information Alert Message Check for Incorrect Entries Using the Auditing Toolbar Set a Range of Numeric Values That Can Be Entered in a Cell Determine If Entry Is Valid Based on Calculation in Another Cell REFERENCES

SUMMARY

Data validation is a feature available in Microsoft Excel. It allows you to do the following: Make a list of the entries that restricts the values allowed in a cell. Create a prompt message explaining the kind of data allowed in a cell. Create messages that appear when incorrect data has been entered. Check for incorrect entries by using the Auditing toolbar. Set a range of numeric values that can be entered in a cell. Determine if an entry is valid based on calculation in another cell.

Back to the top

MORE INFORMATION
This article describes some of the ways to use the data validation feature in Microsoft Excel as well as examples to illustrate how to implement this feature. NOTE: The examples below assume you are working with a new Microsoft Excel workbook and that you start with the first example and continue through the examples in the order in which they are presented. Back to the top

Make a List of Entries Allowed in the Cell


You can make a list of the entries you will accept for a cell on a worksheet. You can then restrict the cell to accept only entries taken from the list by using the data validation feature. To create a drop-down list and restrict values in the cell to these entries, follow these steps: 1. 2. 3. 4. 5. Select cell A1. On the Data menu, click Validation. On the Settings tab, click List in the Allow drop-down list. By default, the Ignore blank and In-cell Dropdown check boxes are selected. Do not change them. In the Source box, type a,b,c.

NOTE: You can also enter a named range or cell reference if it contains a list of values. Both must be preceded by an equal sign. 6. Click OK. Cell A1 now has a drop-down list next to it and you can use this list to select the value to enter in the cell. 7. Click the drop-down list and then click any item it contains. This value will be entered in the cell. NOTE: You can manually enter "a", "b", or "c", (without quotation marks) in the cell; you do not have to select these from the list. If you try to manually enter anything other these values, a stop message appears and you are unable to keep the value in this cell. Your only options are Retry or Cancel. Back to the top

Create a Prompt Message Explaining the Type of Data Allowed in a Cell


You can create a message that explains the type of data that can be entered in a cell. When you select the cell, the message appears near the cell. You can move this message, if necessary, and it remains until you move to another cell or press ESC. If the Office Assistant is visible, the message appears in a balloon above the Office Assistant. Continuing with the previous example, follow these steps: 1. Select cell A1. 2. On the Data menu, click Validation and then click the Input Message tab. NOTE: Make sure the Show input message when cell is selected check box is selected. 3. In the Title box, type List for cell A1. This is the title for the message box that appears. It is in bold text. 4. In the Input message box, type Please select either a, b or c from the drop-down list. This is the body of the message that appears.

5. Click OK. The message appears because cell A1 is selected. 6. Select cell A10. The drop-down list next to cell A1 and the message for cell A1 both disappear. 7. Select cell A1. Both the drop-down list and the prompt message appear next to cell A1. NOTE: If the Office Assistant is visible, the prompt message appears in a balloon above the Office Assistant. 8. Move the message to another location in the worksheet. When you select another cell and then select cell A1 again, the message appears in its new location. NOTE: There is no way to change the formatting for this message. Back to the top

Create a Message That Appears When Incorrect Data Is Entered


The style of the error message Microsoft Excel displays when you type incorrect data determines whether the restrictions are enforced. You can display a message that stops you from entering data values except those specified. You can also display explanatory and warning messages that let you enter out-of-range data, or you can set limits on the data but not display any messages. Continuing with the previous example, follow these steps: 1. Select cell A1. 2. On the Data menu, click Validation and then click the Error Alert tab. NOTE: Make sure the Show error alert after invalid data is entered check box is selected. Back to the top

Create a Stop Alert Message


If you create a Stop Alert message and enter invalid data in the cell, your only options are Retry or Cancel; you are not allowed to enter invalid data in the cell. a. In the Style list, click Stop. b. In the Title box, type Warning for cell A1. This is the title for the message box that appears. c. In the Error Message edit box, enter The only allowable values for cell A1 are a, b, or c. This is the body of the message that appears and is limited to 225 characters. d. Click OK. 3. Manually enter t, in cell A1. The Stop Alert message you created appears and your only options are Retry or Cancel. 4. Click Cancel on the Stop Alert message box. 5. Select cell A1. 6. On the Data menu, click Validation and then click the Error Alert tab. NOTE: Make sure the Show error alert after invalid data is entered check box is selected. Back to the top

Create a Warning Alert Message


If you create a Warning message and enter invalid data in the cell, your options are a little more flexible than for a Stop Alert message. A Warning Alert message has three options: Yes, to allow entry of the invalid data; No, to give you a chance to enter valid data; and Cancel, to remove the invalid entry. a. In the Style list, click Warning. b. In the Title box, type Warning for cell A1. This is the title for the message box that appears. c. In the Error message box, type The only allowable values for cell A1 are a, b, or c. This is

the body of the message that appears and is limited to 225 characters. d. Click OK. 7. Manually enter j in cell A1. The Warning message you created appears asking if you want to Continue. 8. Click Yes. The invalid value of "j" is entered in cell A1. 9. Select cell A1. 10. On the Data menu, click Validation and then click the Error Alert tab. NOTE: Make sure the Show error alert after invalid data is entered check box is selected. Back to the top

Create an Information Alert Message


If you create an Information message and enter invalid data in the cell, your options are the most flexible. When an Information Alert message appears, you can click OK to accept the invalid value or you can click Cancel to reject it. a. In the Style list, click Information. b. In the Title box, type Warning for cell A1. This is the title for the message box that appears. c. In the Error message box, type The only allowable value for cell A1 are a, b, or c. This is the body of the message that appears and is limited to 225 characters. d. Click OK. 11. Manually enter p in cell A1. The Information Alert message you created appears asking if you want to accept or reject the value you entered. 12. Click OK. The invalid value of "p" is entered in cell A1. Back to the top

Check for Incorrect Entries Using the Auditing Toolbar


After your data is entered, you can look for entries that are outside the limits you set. When you click Circle Invalid Data on the Auditing toolbar, circles appear around cells that contain incorrect entries. If you correct an invalid entry, the circle disappears. Continuing with the previous example, follow these steps: 1. On the Tools menu, click Customize. 2. In the Customize dialog box, click the Toolbars tab. 3. In the Toolbars list, click to select the Auditing check box (if it's not already selected) and then click Close. 4. On the Auditing toolbar, click the Circle Invalid Data control. Cell A1 is circled. 5. Select cell A1. 6. Click the drop-down arrow next to cell A1 and then click one of the entries in the list. The circle disappears. Back to the top

Set a Range of Numeric Values That Can Be Entered in a Cell


You can place limits on the data that can be entered in a cell, you can set minimums and maximums or check for the effect an entry might have on another cell. 1. 2. 3. 4. 5. Select cell A5. On the Data menu, click Validation and click the Settings tab. In the Allow list, click Whole number. In the Data list, click between. In the Minimum box, enter 1.

6. In the Maximum box, enter 10. NOTE: You can use cell references for Steps 5 and 6 to specify cells that contain the minimum and maximum values. 7. Click OK. 8. Enter the value 3 in cell A5. The value is entered without error. 9. Enter the value 33 in cell A5. Because the data validation settings you created for cell A1 (an Information Alert) do not apply to those for cell A5, you receive a Stop Alert message (which is the default value) and your only options are to click Retry or Cancel. 10. Click Cancel. The value of 3 appears in the cell. Back to the top

Determine If Entry Is Valid Based on Calculation in Another Cell


In the data validation dialog box you can use a formula, an expression or a reference to a calculation in another cell to determine if the entry you make is valid. 1. Enter the value 1 in cell B10. 2. Select cell A10. 3. On the Data menu, click Validation and click the Settings tab. 4. In the Allow list, click Custom. 5. In the Formula box enter the following formula: =IF(A10>B10,TRUE,FALSE) NOTE: The formula you enter must begin with an equal sign and it must evaluate to either true or false. It is not limited to the IF function. 6. Click OK. 7. Enter the value -1 in cell A10. You receive a Stop Alert message stating the value is invalid. 8. Click Retry. 9. Enter the value 3 in cell A10. You do not receive any error message since this value is greater than the value you entered in cell B10. Back to the top

REFERENCES
For more information about data validation, click Microsoft Excel Help on the Help menu, type data validation in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. Back to the top

XL: Finding the Balance of a Loan for a Given Period


View products that this article applies to. Article ID : 214091 Last Review : January 24, 2007 Revision : 2.3

This article was previously published under Q214091

On This Page
SUMMARY MORE INFORMATION Example 1: Monthly Payments Example 2: Annual Payments

SUMMARY
To calculate the balance of a loan for any period during the life of the loan, use the IPMT function to calculate the interest payment for the next period and divide it by the interest rate of the loan. Back to the top

MORE INFORMATION
The following examples demonstrate the use of the IPMT function to find the balance of a loan using the following formula =IPMT(rate,per,nper,PV)/rate where rate is the interest per payment period, per is the period for which you want to find the balance, nper is the total number of payment periods, and PV is the present value of the loan. Back to the top

Example 1: Monthly Payments


To find the balance of a $65,000 loan after 36 payments (3 years), when the rate of the loan is 9.5 percent per year, and payments are made monthly over a period of 30 years, calculate the interest payment (IPMT) of the loan for the next payment period and divide it by the computed interest rate, as in the following example. In cell A1 of an Excel worksheet, enter: =IPMT(9.5%/12,37,30*12,-65000)/(9.5%/12) Note that 9.5%/12 is the interest rate per period, 37 is the period for which you want to know your balance, 30*12 is total number of payment periods, and -65,000 is the present balance of the loan. This formula returns the value of $63,674.26. Back to the top

Example 2: Annual Payments


To find the balance of a $65,000 loan after 3 payments (3 years), when the rate of the loan is 9.5 percent per year, and payments are made yearly over a period of 30 years, calculate the IPMT of the loan for the next payment period and divide it by the computed interest rate, as in the following example: =IPMT(9.5%,4,30,-65000)/9.5% This formula returns a value of $63,569.61. In this example, there is no need to divide the rate and multiply the years by 12, because the number of payments per year is 1. Back to the top

Formulas that return the last or first day of a month


View products that this article applies to. Article ID : 214101 Last Review : January 24, 2007 Revision : 4.1

This article was previously published under Q214101

SUMMARY
This article describes how to create a formula that returns the last or first day of the current month in Microsoft Excel.

MORE INFORMATION
You can use the EOMONTH function to return the last day of the current month. For example, the following formula =EOMONTH(TODAY(),0) returns the last day of the current month. Because the second argument (the MONTHS argument) is 0 (zero), the function assumes that the month that you want to use is the current month. If the second

argument is 1, the function returns the last day of the following month. To find the first day of the following month, use the following EOMONTH function: =EOMONTH(TODAY(),0)+1 This function is part of the Analysis ToolPak add-in. If you do not click Tools, and then click Add-ins to install and enable the Analysis ToolPak add-in, the formula will return a #VALUE error. You will also receive a #NAME error if either of the function arguments is nonnumeric.

XL: Function to Compute Interest and Growth Rate on a Single Payment


View products that this article applies to. Article ID : 214113 Last Review : January 24, 2007 Revision : 2.1

This article was previously published under Q214113

On This Page
SUMMARY Example

SUMMARY
In Microsoft Excel, the RATE function assumes a stream of payments. If you want to compute the interest rate for a single payment (present value) over a given period, use the following formula = ((FV/PV)^(1/N))-1 where: PV equals the value today (present value).

FV equals the value at the end of the time period (future value). N equals the total number of periods.
Keep in mind that the rate is for 1 period; therefore, for 10 years, use N=10 to obtain the annual rate, or use N=120 (10*12) to obtain the monthly rate. NOTE: This function is the equivalent of the @RATE function in Lotus 1-2-3 when used to find a compound growth rate. Back to the top

Example
To find the annual rate of interest accrued by $1000.00 invested today with an expected yield of $5000.00 in 10 years, use the following function: = ((5000/1000)^(1/10))-1 = 17.46% This means that an interest rate of 17.46% compounded annually is required to yield $5000.00 in 10 years from an initial investment of $1000.00. Back to the top

XL: Macro to Place Filenames in Given Directory on Worksheet


View products that this article applies to. Article ID : 74493 Last Review : November 16, 2006 Revision : 3.1

This article was previously published under Q74493

SUMMARY
The sample macros in this article place the names of all specified file types (specified by file name extension, for example .XLS) for a specified directory into a column on a worksheet.

MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Before you run these macros, open a new worksheet and select the cell of the range into which you want the file names to be placed. To list different file types, you must modify the sample macros by changing the argument in the Dir() function. To return all Microsoft Excel add-in macros, replace "*.XLS" with "*.XLA," and so on. The specified directory can be any valid directory. To search a different folder, change <ExcelFiles> to the folder containing your Excel workbook files. 1. In a new a module sheet, type the following:

Sub ListFiles() F = Dir("C:\<ExcelFiles>\*.XLS") Do While Len(F) > 0 ActiveCell.Formula = F ActiveCell.Offset(1, 0).Select F = Dir() Loop End Sub
2. To run the macro, open a new worksheet. Select cell A1. 3. On the Tools menu, point to Macro, and then click Macros. In the list of available macros, select the ListFiles macro, and then click Run. All workbook files located in the <ExcelFiles> directory will be listed in column A in the worksheet. To modify the macro so that it returns the file names in a row rather than in a column, change this line

ActiveCell.Offset(1, 0).Select
to this:

ActiveCell.Offset(0, 1).Select

XL: Method to Determine Whether a Year Is a Leap Year


View products that this article applies to. Article ID : 214019 Last Review : January 24, 2007 Revision : 3.1

This article was previously published under Q214019

On This Page
SUMMARY MORE INFORMATION To Determine If a Year Is a Leap Year Formula to Determine If a Year Is a Leap Year

SUMMARY
This article contains information that explains how to determine whether the year in a date used in a Microsoft Excel document is a leap year. Back to the top

MORE INFORMATION
The date system used by Excel is based on the Gregorian calendar, first established in 1582 by Pope Gregory XIII. This calendar was designed to correct the errors introduced by the less accurate Julian

calendar. In the Gregorian calendar, a normal year consists of 365 days. Because the actual length of a sidereal year (the time required for the Earth to revolve once about the Sun) is actually 365.25635 days, a "leap year" of 366 days is used once every four years to eliminate the error caused by three normal (but short) years. Any year that is evenly divisible by 4 is a leap year: for example, 1988, 1992, and 1996 are leap years. However, there is still a small error that must be accounted for. To eliminate this error, the Gregorian calendar stipulates that a year that is evenly divisible by 100 (for example, 1900) is a leap year only if it is also evenly divisible by 400. For this reason, the following years ARE NOT leap years 1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600 because they are evenly divisible by 100 but NOT by 400. The following years ARE leap years 1600, 2000, 2400 because they are evenly divisible by both 100 and 400. Because versions of Microsoft Excel earlier than Excel 97 handle only years from 1900 to 2078, only the year 1900 is subject to the 100/400 exclusion rule of leap years in Microsoft Excel. However, in order to be compatible with other programs, Microsoft Excel treats the year 1900 as a leap year. For additional information, please see the following article in the Microsoft Knowledge Base: 214058 XL2000: Days of the Week Before March 1, 1900 Are Incorrect Back to the top

To Determine If a Year Is a Leap Year


1. 2. 3. 4. 5. To determine if a year is a leap year, follow these steps: If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. The year is a leap year (it has 366 days). The year is not a leap year (it has 365 days). Back to the top

Formula to Determine If a Year Is a Leap Year


The following formula will determine whether the year number entered into a cell (in this example, cell A1) is a leap year: =IF(OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)<>0)),"Leap Year", "NOT a Leap Year")

If the value in cell A1 is this The formula returns ---------------------------------------------------------- 1992 Leap Year 2000 Leap Year 1900 NOT a Leap Year
Back to the top

XL2000: Calculating the Number of Days Between Two Dates


View products that this article applies to. Article ID : 214315 Last Review : November 5, 2003 Revision : 4.0

This article was previously published under Q214315

SUMMARY
This article shows you a formula that you can use in Microsoft Excel 2000 to find the number of days between two dates.

MORE INFORMATION
To find the number of days between two dates, you can use the following formula =Date2-Date1 where "Date2" represents the later of the two dates and "Date1" represents the earlier of the two dates. Format the cell that contains this formula as General so that the cell displays the difference between the two dates in number of days.

How to calculate weighted averages in Excel 2000


View products that this article applies to. Article ID : 214049 Last Review : September 9, 2004 Revision : 4.1

This article was previously published under Q214049 For a Microsoft Excel 97 version of this article, see 109211. For a Microsoft Excel 98 version of this article, see 192377.

SUMMARY
A weighted average differs from an average in that a weighted average returns a number that depends on the variables of both value and weight. Consider the following example: A shipment of 10 cases of widgets costs $0.20 per case. Because of heavy consumption of widgets, a second shipment of 40 cases now costs $0.30 per case. The average cost of the cases in each shipment -- determined by the formula ($0.20+$0.30)/2 = $0.25 -- is not an accurate measure of the average cost of the cases because it does not take into account that there are 30 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 in these two shipments.

MORE INFORMATION
To find a weighted average, follow these steps: 1. In a new worksheet, type the following data:

A1: Cost B1: Cases A2: $.20 B2: 10 A3: $.30 B3: 40
2. Type the formula below in any blank cell (it is not necessary to type this formula as an array): =SUMPRODUCT(A2:A3,B2:B3)/SUM(B2:B3)

XL2000: Changing an Integer to an Excel Serial Number


View products that this article applies to. Article ID : 213446 Last Review : November 23, 2006 Revision : 3.3

This article was previously published under Q213446

SUMMARY
Many programs export dates as integers. This article contains a sample Microsoft Visual Basic for Applications macro (Sub procedure) that transforms an integer date into a Microsoft Excel serial number. Back to the top

MORE INFORMATION
Microsoft provides programming 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 article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft feebased consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: https://partner.microsoft.com/global/30000104 For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS This sample macro assumes that the integer date is in the active cell of the worksheet in the form of 980812 (that is, year/month/day). The macro can be adapted for other integer date formats by changing the references in the DATE function. To run the macro, follow these steps: CAUTION: This macro overwrites the original date with the new date. 1. Start Microsoft Excel and open the workbook with the dates that you want to convert. 2. Start the Visual Basic Editor. (Press ALT+F11) 3. On the Insert menu, click Module. 4. Type the following code into the module sheet:

Sub ConvertInteger() ' Extract the first two digits. yr = Fix(ActiveCell * 0.0001) ' Extract the second two digits. mo = Right(Fix((ActiveCell (yr * 10000)) * 0.01), 2) ' Extract the last two digits. dy = ActiveCell - (Fix(ActiveCell * 0.01) * 100) ' Return the result to the original cell in Microsoft Excel date ' format. ActiveCell.Value = DateSerial(yr, mo, dy) End Sub
5. Return to Microsoft Excel (Press ALT+F11). 6. Click a cell in the worksheet that has a date that needs to be converted, click the Tools menu, point to Macro, and then click Macros. 7. Click ConvertInteger, and then click Run. If the active cell contains the number 000101, the ConvertInteger macro converts the cell contents to 1/1/00. Excel recognizes the new contents of the cell as a date (00 is automatically recognized as 2000), so you can perform date calculations on the cell. Back to the top

REFERENCES
For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base: 212536 OFF2000: How to Run Sample Code from Knowledge Base Articles

How to convert multiple rows and columns to columns and rows in Excel
View products that this article applies to. Article ID : 214024

Last Review : January 24, 2007 Revision : 4.1

This article was previously published under Q214024 For a Microsoft Excel 98 version of this article, see 192357. For a Microsoft Excel 97 version of this article, see 116289.

On This Page

SUMMARY MORE INFORMATION Example

SUMMARY
When you use the Microsoft Excel products listed at the beginning of this article, you can use a worksheet formula to covert data that spans multiple rows and columns to a database format (columnar). Back to the top

MORE INFORMATION
The following example converts every four rows of data in a column to four columns of data in a single row (similar to a database field and record layout). This is a similar scenario as that which you experience when you open a worksheet or text file that contains data in a mailing label format. Back to the top

Example
1. In a new worksheet, type the following data: A1: Smith, John A2: 111 Pine St. A3: San Diego, CA A4: (555) 128-549 A5: Jones, Sue A6: 222 Oak Ln. A7: New York, NY A8: (555) 238-1845 A9: Anderson, Tom A10: 333 Cherry Ave. A11: Chicago, IL A12: (555) 581-4914 2. Type the following formula in cell C1: =OFFSET($A$1,(ROW()-1)*4+INT((COLUMN()-3)),MOD(COLUMN()-3,1)) 3. Fill this formula across to column F, and then down to row 3. 4. Adjust the column sizes as necessary. Note that the data is now displayed in cells C1 through F3 as follows:

Smith, John 111 Pine St. San Diego, CA (555) 128-549 Jones, Sue 222 Oak Ln. New York, NY (555) 238-1845 Anderson, Tom 333 Cherry Ave. Chicago, IL (555) 581-4914
The formula can be interpreted as 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 that make one record of data col_in_set = number of columns of data

How to create charts with multiple groups of stacked bars in Excel 2000
View products that this article applies to. Article ID : 214119 Last Review : September 9, 2004 Revision : 3.1

This article was previously published under Q214119 For a Microsoft Excel 97 version of this article, see 77241.

SUMMARY
Normally, data series in a stacked column or bar chart have one stack per category. However, it is possible to arrange your data so that the chart appears to have more than one stack per category. Back to the top

MORE INFORMATION
The following sample data produces 10 different stacks with two columns each. The first column has the Y2 value stacked over the Y1 value; every other column has the Y3 value stacked over the Y4 value. To create the chart, follow these steps: 1. Type the following data into a new worksheet:

A1 : E2 : A5 : B7 : C9 : D11:

X B1 : Y1 A3 : B3 : B5 : C5 : C7 : D7 : D9 : 3 E9 3 E11: 4

C1 : Y2 D1 : Y3 E1 : Y4 A2 : X1 B2 : 1 C2 : 2 C3 : D3 : 3 E3 : 4 A4 : X2 B4 : 1 C4 : 2 D4 : D5 : 3 E5 : 4 A6 : X3 B6 : 1 C6 : 2 D6 : E6 : 3 E7 : 4 A8 : X4 B8 : 1 C8 : 2 D8 : E8 : A9 : : 4 A10: X5 B10: 1 C10: 2 D10: E10: A11: B11:

D2 : E4 : A7 : B9 : C11:

2. Select cells A1:E11, and then click Chart on the Insert menu. 3. Click the Standard Types tab. Click Column in the Chart type list, click the Stacked Column icon (the second selection) under Chart sub-type, and then click Next. 4. In step 2 of the Chart Wizard, click the Series tab. In the Series list, click X, and then click Remove. 5. Type the following in the Category (X) axis labels box: =Sheet1!A2:A11 6. Click Next twice to move to step 4 of the Chart Wizard. 7. Click As new sheet, and then click Finish. The labels X1 through X5 appear along the horizontal axis. Y1 through Y4 appear in the legend as series names. You can extend this chart to include more groups by adding more data in two rows for each new group. The number of rows per category label defines the number of stacks per group. To add another group of two bars, insert a row before each X label, and then add two more columns of data in the new row, such as Y5 and Y6. The number of columns of data per row defines the number of columns in each stack. For example, if the values for Y3 in the chart (displayed in step 1) are moved to the first row of each group, the chart still has two stacks per group. However, the first stack contains three columns and the second stack contains only one column. Back to the top

REFERENCES
For more information about chart types, click Microsoft Excel Help on the Help menu, type examples of chart types in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

XL2000: Formula for Cumulative Category Total


View products that this article applies to. Article ID : 214241 Last Review : September 27, 2003 Revision : 3.0

This article was previously published under Q214241

SUMMARY
In Microsoft Excel 2000, if you have a column of categories and a column of values, you can calculate a running category total in a third column.

MORE INFORMATION
If you have a column of categories and a column of values, you can create a running category total, as in the following example:

Categories Values Running category total ----------------------------------------------- 1 $4.00 $4.00 2 $8.00 $8.00 1 $5.00 $9.00 2 $7.00 $15.00 1 $5.00 $14.00 3 $4.00 $4.00 4 $3.00 $3.00 2 $5.00 $20.00 1 $7.00 $21.00 1 $7.00 $28.00 4 $5.00 $8.00 3 $5.00 $9.00 2 $5.00 $25.00 2 $6.00 $31.00 3 $5.00 $14.00 4 $6.00 $14.00 4 $7.00 $21.00 3 $4.00 $18.00 2 $6.00 $37.00 2 $7.00 $44.00 1 $6.00 $34.00 1 $6.00 $40.00 1 $4.00 $44.00 1 $6.00 $50.00 4 $5.00 $26.00 4 $5.00 $31.00 2 $6.00 $50.00 1 $6.00 $56.00 2 $3.00 $53.00
Assuming that the category column is column A, the values column is column B, and the headings are in row 1, the running category total formula at the top row is: =SUMIF(INDIRECT("A2:A"&ROW()),"="&A2,INDIRECT("B2:B"&ROW())) Copy the formula for all rows used. For more information about the SUMIF formula, click Microsoft Excel Help on the Help menu, type sumif worksheet function in the Office Assistant or the Answer Wizard, and then click Search to view the topic. For more information about the INDIRECT formula, click Microsoft Excel Help on the Help menu, type indirect worksheet function in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

XL2000: Formula to Count the Number of Rows in Which an Item Appears


View products that this article applies to. Article ID : 214079 Last Review : September 27, 2003 Revision : 3.0

This article was previously published under Q214079

SUMMARY

In Microsoft Excel, you can use the FREQUENCY() function in a SUM(IF()) array formula to count the number of rows in which an item appears within a specified range. To count how many rows in which a value appears in a specified range, use the following formula =SUM(IF(FREQUENCY(IF(range=item,ROW(range)), IF(range=item,ROW(range)))>0,1,0)) where range is the range that you want to search, and item is the number or text string that you want to find within each row. If you are searching for a text string, include quotation marks around both instances of item. NOTE: The formulas discussed in this article must be entered as array formulas by pressing CTRL+SHIFT+ENTER.

MORE INFORMATION
For example, to find out how many rows in which "XXX" appears within the following range

A1: XXX B1: XXX C1: XXX A2: YYY B2: XXX C2: XXX A3: DDD B3: DDD C3: YYY A4: XXX B4: YYY C4: DDD
use the following array formula: =SUM(IF(FREQUENCY(IF(A1:C4="XXX",ROW(A1:C4)), IF(A1:C4="XXX",ROW(A1:C4)))>0,1,0)) This formula returns the value 3, indicating that "XXX" is contained in three rows of the range.

XL2000: Formula to Find Number of Weekdays Between Dates


View products that this article applies to. Article ID : 214141 Last Review : November 5, 2003 Revision : 4.0

This article was previously published under Q214141

SUMMARY
This article describes a simple formula to calculate the number of weekdays (workdays) between two dates. Back to the top

MORE INFORMATION
You can use the following formula to find the number of weekdays between two dates, where cell A1 contains the beginning date and cell A2 contains the ending date: =NETWORKDAYS(A1,A2) If the NETWORKDAYS function is not available, you must run the Microsoft Excel Setup program and install the Analysis ToolPak. After you install the Analysis ToolPak, you must enable it by using the AddIns command on the Tools menu. Back to the top

REFERENCES
For more information about the NETWORKDAYS function, click Microsoft Excel Help on the Help menu, type networkdays in the Office Assistant or the Answer Wizard, and then click Search to view the topic. Back to the top

XL2000: Formula to Sum Digits of a Number

View products that this article applies to. Article ID : 214053 Last Review : September 27, 2003 Revision : 3.0

This article was previously published under Q214053

On This Page

SUMMARY MORE INFORMATION Formula 1: Sum the Digits of a Positive Number Formula 2: Sum the Digits of a Negative Number Explanation of the Formulas

SUMMARY
This article describes formulas that you can use to find the sum of the digits of a number in Microsoft Excel 2000. Back to the top

MORE INFORMATION
Formula 1: Sum the Digits of a Positive Number
To return the sum of the digits of a positive number contained in cell A10, follow these steps: 1. Start Excel 2000. 2. Type 123456 in cell A10. 3. Type the following formula in cell B10: =SUM(VALUE(MID(A10,ROW(A1:OFFSET(A1,LEN(A10)-1,0)),1))) 4. Press CTRL+SHIFT+ENTER to enter the formula as an array formula. 5. The formula returns the value 21. Back to the top

Formula 2: Sum the Digits of a Negative Number


To return the sum of the digits of a negative number contained in cell A11, follow these steps: 1. Type -234567 in cell A11. 2. Type the following formula in cell B11: =SUM(VALUE(MID(A11,ROW(A2:OFFSET(A2,LEN(A11)-2,0)),1))) 3. Press CTRL+SHIFT+ENTER to enter the formula as an array formula. 4. The formula returns the value 27. Back to the top

Explanation of the Formulas


The following information assumes that cell A1 contains the number 849.

This part of the formula Does this ----------------------------------------------------------------------- A1:OFFSET(A1,LEN(A1)-1,0) Creates a reference of cells going down a column that has the same number of cells as the number in A1 has digits. For example, the formula A1:OFFSET(A1,LEN(A1)-1,0) returns A1:A3 because LEN(A1)-1 equals 2 and OFFSET(A1,2,0) returns A3. ROW() Returns the row number of the cell reference. If there is more than one cell in the reference, it returns an array. In this case, ROW(A1:A3) returns {1;2;3}. MID() Returns a portion of a text string. By using an array for one of the arguments, you can return multiple text strings in an array. For example, consider MID(849,{1;2;3},1) from the above paragraph. This returns {"8";"4":"9"}. Notice that all the numbers are text inside the array. VALUE() Changes text to numbers. In this

example, VALUE({"8";"4":"9"}) returns {8;4;9}. This allows the numbers to be summed. SUM({8;4;9}) Returns the final result, 21.
The second formula, which sums the digits of negative numbers, works in a similar manner except that it compensates for the initial minus sign (-) in the number. Note that in each formula, the "A1" and "A2" are always used, regardless of which cell's digits are being summed.

How to use macros to delete duplicate items in a list in Excel 2000


View products that this article applies to. Article ID : 240077 Last Review : October 11, 2006 Revision : 4.2

This article was previously published under Q240077 For a Microsoft Excel 2002 version of this article, see 291320.

On This Page

SUMMARY MORE INFORMATION Sample 1: Delete Duplicate Items in a Single List Sample 2: Compare Two Lists and Delete Duplicate Items REFERENCES

SUMMARY
In Microsoft Excel, you can create a macro to delete duplicate items in a list. You can also create a macro to compare two lists, and delete items in the second list that are also in the first (master) list. This is helpful if you want to merge two lists together, or if you only want to see the new information. This article includes sample Microsoft Visual Basic for Applications macros (Sub procedures) that show how to delete duplicate records in a single list (Sample 1), and how to delete duplicate records after comparing one list against another (Sample 2). These macros do not require the list to be sorted. Also, the macros delete any number of duplicates, regardless of whether an item is duplicated once or several times in the list. Back to the top

MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Back to the top

Sample 1: Delete Duplicate Items in a Single List


The following sample macro searches a single list in the range A1:A100 and deletes all duplicate items in the list. This macro requires that you do not have empty cells in the list range. If your list does contain empty cells, sort the data in ascending order so that the empty cells are all at the end of your list.

Sub DelDups_OneList() Dim iListCount As Integer Dim iCtr As Integer ' Turn off screen updating to speed up macro. Application.ScreenUpdating = False ' Get count of records to search through. iListCount = Sheets("Sheet1").Range("A1:A100").Rows.Count

Sheets("Sheet1").Range("A1").Select ' Loop until end of records. Do Until ActiveCell = "" ' Loop through records. For iCtr = 1 To iListCount ' Don't compare against yourself. ' To specify a different column, change 1 to the column number. If ActiveCell.Row <> Sheets("Sheet1").Cells(iCtr, 1).Row Then ' Do comparison of next record. If ActiveCell.Value = Sheets("Sheet1").Cells(iCtr, 1).Value Then ' If match is true then delete row. Sheets("Sheet1").Cells(iCtr, 1).Delete xlShiftUp ' Increment counter to account for deleted row. iCtr = iCtr + 1 End If End If Next iCtr ' Go to next record. ActiveCell.Offset(1, 0).Select Loop Application.ScreenUpdating = True MsgBox "Done!" End Sub
Back to the top

Sample 2: Compare Two Lists and Delete Duplicate Items


The following sample macro compares one (master) list against another list, and deletes duplicate items in the second list that are also in the master list. The first list is on Sheet1 in the range A1:A10. The second list is on Sheet2 in the range A1:A100. To use the macro, select either sheet, and then run the macro.

Sub DelDups_TwoLists() Dim iListCount As Integer Dim iCtr As Integer ' Turn off screen updating to speed up macro. Application.ScreenUpdating = False ' Get count of records to search through (list that will be deleted). iListCount = Sheets("sheet2").Range("A1:A100").Rows.Count ' Loop through the "master" list. For Each x In Sheets("Sheet1").Range("A1:A10") ' Loop through all records in the second list. For iCtr = 1 To iListCount ' Do comparison of next record. ' To specify a different column, change 1 to the column number. If x.Value = Sheets("Sheet2").Cells(iCtr, 1).Value Then ' If match is true then delete row. Sheets("Sheet2").Cells(iCtr, 1).Delete xlShiftUp ' Increment counter to account for deleted row. iCtr = iCtr + 1 End If Next iCtr Next Application.ScreenUpdating = True MsgBox "Done!" End Sub
Back to the top

XL2000: Macro to Extract Data from a Chart


View products that this article applies to. Article ID : 213814 Last Review : October 10, 2006 Revision : 4.2

This article was previously published under Q213814 For a Microsoft Excel 2002 version of this article, see 300643. For a Microsoft Excel 98 and earlier version of this article, see 137016.

On This Page

SUMMARY MORE INFORMATION Steps to Link the Chart to the Recovered Data

SUMMARY
In Microsoft Excel, you can retrieve data from a chart even when the data is in an external worksheet or workbook. This is useful in situations where the chart was created from, or linked to, another file that is unavailable or has been damaged in some way. When the source data to a chart is lost, the data can still be retrieved from the chart itself, by using a Microsoft Visual Basic for Applications macro. Back to the top

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following sample macro places the chart's source data in a worksheet called "ChartData" in the active workbook, beginning in the first column and first row. 1. Enter the following macro code in a module sheet:

Sub GetChartValues() Dim NumberOfRows As Integer Dim X As Object Counter = 2 ' Calculate the number of rows of data. NumberOfRows = UBound(ActiveChart.SeriesCollection(1).Values) Worksheets("ChartData").Cells(1, 1) = "X Values" ' Write x-axis values to worksheet. With Worksheets("ChartData") .Range(.Cells(2, 1), _ .Cells(NumberOfRows + 1, 1)) = _ Application.Transpose(ActiveChart.SeriesCollection(1).XValues) End With ' Loop through all series in the chart and write their values to ' the worksheet. For Each X In ActiveChart.SeriesCollection Worksheets("ChartData").Cells(1, Counter) = X.Name With Worksheets("ChartData") .Range(.Cells(2, Counter), _ .Cells(NumberOfRows + 1, Counter)) = _ Application.Transpose(X.Values) End With Counter = Counter + 1 Next End Sub
2. Insert a new worksheet into your workbook and rename it to "ChartData" (without the quotation marks). 3. Select the chart from which you want to extract the underlying data values. NOTE: The chart can either be embedded on a worksheet or on a separate chart sheet. 4. Run the GetChartValues macro. The data from the chart is placed in the "ChartData" worksheet. Back to the top

Steps to Link the Chart to the Recovered Data


To have the chart be interactive with the recovered data, you need to link the chart to the new data sheet rather than retain the links to the missing or damaged workbook. 1. Select the chart, and click a series to find the sheet name to which the chart is linked in the damaged or missing workbook. The sheet name appears in the series formula in the formula bar. NOTE: The sheet name may follow the workbook name, which is enclosed in square brackets such as "[Book1]," and precede the exclamation point "!" (or apostrophe and exclamation point "'!") that indicates the beginning of a cell reference. The sheet name includes only the characters between the closed square bracket symbol "]" and the exclamation point (or apostrophe and exclamation point). Leave out any apostrophe if it is immediately before the exclamation mark, because an apostrophe can not be the last character in a sheet name. Double-click the tab of the new sheet called ChartData. Type the original sheet name from step 1 over the highlighted "ChartData" and press ENTER. This name must be the same as the sheet name from the damaged or missing workbook. If you have not saved this file with the chart and data sheet, save the file. On the Edit menu, click Links, and then click Change Source. In the Source File box, select the link to change, and then click Change Source. In the Change Links dialog box, select the new file with the recovered data and chart, and then click OK. If you receive the following error message Your formula contains an invalid external reference to a worksheet. it is likely that the sheet name that you typed in step 3 is not the same as the original. Go back to step 1. The Source File box may now be blank. This indicates that all links point to the active file rather than the missing or damaged file. Click Close.

2. 3. 4. 5. 6. 7. 8.

9.

The chart now references and interacts with the recovered data on the renamed sheet in the active workbook.

How to use a macro to apply cell shading format to every other row in a selected range in Excel
View products that this article applies to. Article ID : 213616 Last Review : January 10, 2007 Revision : 7.0

This article was previously published under Q213616

On This Page

SUMMARY MORE INFORMATION Sample Visual Basic Procedure REFERENCES

SUMMARY
Microsoft Excel automatically formats new data that you type at the end of a list to match the previous rows. You can also format a list programmatically. This article contains a sample Microsoft Visual Basic for Applications procedure to shade every other row in a selection. Back to the top

MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To see the patterns available in Microsoft Office Excel 2003 and in earlier versions, click Cells on the Format menu, and then click the Patterns tab. To see the patterns available in Microsoft Office Excel 2007, follow these steps: 1. On the Home tab, click Format in the Cells group . Then, click Format Cells.. 2. In the Format Cells dialog box, click the Fill tab. The Pattern drop-down list displays the available patterns. The pattern that is used in the following macro, referred to by its constant name, xlGray16, is the fifth one from the right in the first row. The following macro sets the pattern in every other row of the current selection to xlGray16. Back to the top

Sample Visual Basic Procedure Sub ShadeEveryOtherRow() Dim Counter As Integer 'For every row in the current selection... For Counter = 1 To Selection.Rows.Count 'If the row is an odd number (within the selection)... If Counter Mod 2 = 1 Then 'Set the pattern to xlGray16. Selection.Rows(Counter).Interior.Pattern = xlGray16 End If Next End Sub
Note This macro runs only on the rows of the selected range. If you add any new rows of data after you run the macro, you must run the macro again with all the new rows of data selected. This process can also be done manually by using conditional formatting.

For additional information about how to format every other row by using conditional formatting, click the following article number to view the article in the Microsoft Knowledge Base: 268568 How to use conditional formatting to shade every other row in Excel You can also format a list by using the AutoFormat menu command. In Excel 2003 and in Microsoft Excel 2002, the AutoFormat menu command is on the Format menu. In Excel 2007, you have to add the AutoFormat menu command to the Quick Access Toolbar. To do this, follow these steps: 1. Click Microsoft Office Button, and then click Excel Options. 2. Click Customize. 3. Click to select the All Commands under the Choose commands from. 4. Click AutoFormat, click Add, and then click OK. Back to the top

REFERENCES
For additional information about how to obtain help with Visual Basic for Applications, click the following article number to view the article in the Microsoft Knowledge Base: 226118 List of resources that are available to help you learn Visual Basic for Applications programming

How to find duplicate entries in a column by using a macro in Excel 2000


View products that this article applies to. Article ID : 213355 Last Review : November 23, 2006 Revision : 3.4

This article was previously published under Q213355 For a Microsoft Excel 97 version of this article, see 142591.

On This Page
SUMMARY MORE INFORMATION Sample Visual Basic Code

SUMMARY
The Microsoft Visual Basic for Applications sample macro in this article finds duplicate cell entries within a column, and changes the color of the cell containing the duplicate entry to red. Back to the top

MORE INFORMATION
Microsoft provides programming 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 article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft feebased consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: https://partner.microsoft.com/global/30000104 For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS For the macro to work correctly, make sure both of the following conditions have been met: The column in which you want to find duplicates has been sorted based on values in that column. -and-

The first cell in the column in which you want to find duplicates is selected.

Back to the top

Sample Visual Basic Code Sub FindDups () ' ' NOTE: You must select the first cell in the column and ' make sure that the column is sorted before running this macro ' ScreenUpdating = False FirstItem = ActiveCell.Value SecondItem = ActiveCell.Offset(1, 0).Value Offsetcount = 1 Do While ActiveCell <> "" If FirstItem = SecondItem Then ActiveCell.Offset(Offsetcount,0).Interior.Color = RGB(255,0,0) Offsetcount = Offsetcount + 1 SecondItem = ActiveCell.Offset(Offsetcount, 0).Value Else ActiveCell.Offset(Offsetcount, 0).Select FirstItem = ActiveCell.Value SecondItem = ActiveCell.Offset(1,0).Value Offsetcount = 1 End If Loop ScreenUpdating = True End Sub
Back to the top

An overview of data tables in Excel 2003 and in Excel 2007


View products that this article applies to. Article ID : 282852 Last Review : January 4, 2007 Revision : 5.0

This article was previously published under Q282852

SUMMARY
You can use data tables to see how different input values affect the results of a formula. By doing so, you can test different input values for a formula without having to retype or copy the formula for each value. To create a data table in Microsoft Excel 2002 or Microsoft Office Excel 2003, click Table on the Data menu. To create a data table in Microsoft Office Excel 2007, follow these steps: 1. In Excel 2007, open a workbook. 2. On the Insert menu, click Table. 3. Provide the source of the data for the table, and then click OK. Back to the top

MORE INFORMATION
The following formula calculates tax on an item based on the item's cost (itemcost): =itemcost*8.1% One way to calculate tax for several items is to type the formula for each item, as shown in the following example:

Table created manually (with formulas displayed) ================================================ | A | B ---|------------|------- 1 |Item Cost |Tax 2 | 15|=A2*8.1% 3 | 17.5| =A3*8.1% 4 | 22.35|=A4*8.1% Table created manually (with values displayed) ============================================== | A | B ---|----------|------- 1 | Item Cost|Tax 2 | $15.00| $1.22 3 | $17.50| $1.42 4 | $22.35| $1.81
In the previous examples, you must type or copy the tax formula for each item you want to evaluate. However, if you create a table with the Table command, you only have to type the formula once:

Table created with the Table command (with formulas displayed) ============================================================== | A | B ---|-----------|------------ 1 | Item Cost | =C1*8.1% <--The formula is

typed once; then the 2 | 15| =TABLE(,C1) <--Table command puts the results here. 3 | 17.5| =TABLE(,C1) 4 | 22.35| =TABLE(,C1) C1 represents a variable. The values in cells A2:A4 are substituted for C1, and the corresponding result is placed in cells B2:B4. Table created with the Table command (with values displayed) ============================================================ | A B ---|-----------|------ 1 |Item Cost |Tax 2 | $15.00| $1.22 3 | $17.50| $1.42 4 | $22.35| $1.81
The values in cells A1 and B1 are number formats. To duplicate these values, follow these steps: 1. Select cell A1. 2. On the Format menu in Office Excel 2003, click Cells. In Office Excel 2007, click Cells , click Format, and then click Format Cells. 3. Click the Number tab. 4. In the Category list, click Custom. 5. In the Type box, type "Item Cost" (with the quotation marks). 6. Click OK. 7. Repeat steps 1-6 for cell B2, but type the format in step 5 as "Tax" (with the quotation marks). Back to the top

REFERENCES
For additional information about how to use data tables, click the article number below to view the article in the Microsoft Knowledge Base: 282851 XL: How to Use Microsoft Excel Data Tables to Analyze Information in a Database 282855 XL: How to Create and Use One-Input Data Tables in Microsoft Excel 282856 XL: How to Create and Use Two-Input Data Tables in Microsoft Excel Back to the top

XL: Contents of the Samples.xls Workbook


View products that this article applies to. Article ID : 213528 Last Review : January 24, 2007 Revision : 3.4

This article was previously published under Q213528 For a Microsoft Excel 97 version of this article, see 162323.

On This Page
SUMMARY MORE INFORMATION Contents Worksheet Functions Conditional Formatting Data Validation Chart Labeling Repeating Tasks Arrays API (Application Programming Interface) Examples Events Automation ADO-ActiveX Data Objects

SUMMARY
Microsoft Excel ships with a file that contains samples for using Excel. This file is called Samples.xls, and it is located in the following folder: Excel 2000

C:\Program Files\Microsoft Office\Office\Samples Excel 2002 C:\Program Files\Microsoft Office\Office 10\Samples This article contains a brief summary of the contents of the Samples.xls workbook. Back to the top

MORE INFORMATION
The Samples.xls workbook contains twelve worksheets: a table of contents worksheet, ten worksheets that are dedicated to a specific topic, and one worksheet that returns you back to the table of contents. Back to the top

Contents
This worksheet contains introductory information, disclaimers, and links to the other worksheets. Back to the top

Worksheet Functions
This worksheet contains sample formulas for completing common spreadsheet tasks, such as:

Suppressing the display of error values in formulas. Indexing, matching, and looking up values by using the Lookup Wizard. Calculating formulas based on conditions.
Back to the top

Conditional Formatting
This worksheet provides two examples that demonstrate how to change cell formatting depending on the current value of the cell. Back to the top

Data Validation
This worksheet provides examples for setting up restrictions for values that can be entered into a cell. Back to the top

Chart Labeling
This worksheet demonstrates how to add labels to points in an xy (scatter) chart programmatically. It provides sample data, a sample chart, and a link to the Visual Basic macros that create and remove the labels. Back to the top

Repeating Tasks
This worksheet contains information about using different types of loops in Visual Basic macros: For Each...Next loops, For...Next loops, and Do... loops. The worksheet contains links to four Visual Basic modules that contain sample code. Back to the top

Arrays
This worksheet contains information about using arrays in Visual Basic for Applications macros. The worksheet contains links to two Visual Basic modules that contain sample code. Back to the top

API (Application Programming Interface) Examples


This worksheet contains nine examples for using API calls from within the programming environment in Excel. Back to the top

Events
This worksheet contains information about having a certain event trigger a macro to perform a specific task. The events that are covered include BeforeDoubleClick, Change, and BeforeClose. Sample code is contained in this worksheet. Back to the top

Automation
This worksheet contains information about automating tasks between Excel and other Office programs, such as Microsoft Word, Microsoft Access, Microsoft PowerPoint, and Microsoft Outlook. Links to sample code are included. Back to the top

ADO-ActiveX Data Objects


This worksheet provides examples that illustrate common database tasks with code. It includes numerous links to sample Visual Basic macros. Back to the top

Number of significant digits MS Excel retains


View products that this article applies to. Article ID : 65903 Last Review : November 16, 2006 Revision : 3.1

This article was previously published under Q65903

SUMMARY
Microsoft Excel retains 15 significant digits. To display all 15 digits, you must use a number format (custom or built-in) other than General. The General number format displays up to 11 numeric characters, with the decimal point counting as a numeric character. Therefore, if the number contains a decimal point, Excel can display up to 10 significant digits, but if the number does not contain a decimal point, Excel can display up to 11 significant digits Adding more numbers to the left of the decimal point causes the number to appear in exponential notation.

XL2000: All Available Toolbars Are Not Listed on the Toolbar Shortcut Menu
View products that this article applies to. Article ID : 214060 Last Review : September 27, 2003 Revision : 3.0

This article was previously published under Q214060

On This Page

SUMMARY MORE INFORMATION Excel Toolbars REFERENCES

SUMMARY

In Microsoft Excel 2000, not all available toolbars are listed on the toolbar shortcut menu. Back to the top

MORE INFORMATION
The toolbar shortcut menu does not display all available toolbars. Therefore, you may need to use the Toolbars or Customize dialog box to show or hide some toolbars. To show or hide a toolbar that is not on the toolbar shortcut menu, use either of the following methods: On the View menu, point to Toolbars, click Customize, and then make the appropriate changes in the Customize dialog box. -orshortcut menu. The toolbar shortcut menu provides a quick way to show or hide toolbars. It also gives quick access to the Toolbars dialog box. To show the toolbar shortcut menu, right-click any visible toolbar. The following toolbars are displayed on the toolbar shortcut menu. Back to the top

Create a custom toolbar that contains the buttons that you want. The custom toolbar is shown on the

Excel Toolbars On toolbar shortcut menu Not on toolbar shortcut menu ------------------------------------------------------------------Standard Stop Recording Formatting Full Screen Chart Circular Reference Clipboard Exit Design Control Toolbox Shadow Settings Drawing 3-D Settings External Data Forms Picture PivotTable Reviewing Visual Basic Web WordArt [any custom toolbars that you create]
Back to the top

XL2000: Defined Names Are Case Sensitive


View products that this article applies to. Article ID : 213533 Last Review : October 10, 2006 Revision : 4.2

This article was previously published under Q213533

SYMPTOMS
When you run a Visual Basic for Applications macro in Microsoft Excel, and your macro code reads the Name property of an item in the Names collection, the result may be slightly different than the result you receive in versions of Excel earlier than Microsoft Excel 97. This behavior occurs because defined names are now case sensitive in Microsoft Excel. This article explains the new behavior and the problems it may cause.

MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. When you define names in a workbook in Microsoft Excel, the workbook cannot contain two or more

defined names that differ from each by only the case of some or all of their letters. For example, you cannot create the following defined names in the same workbook:

Test test tEST TEST


Although the names use different combinations of uppercase and lowercase letters, the letters in each name are all the same. Therefore, Microsoft Excel considers these four names to be identical. Defining a name in a workbook when another identical name (except for the case) already exists results in the elimination of the original name. For example, if you define the name "test" (without the quotation marks), Microsoft Excel eliminates the name "Test" (without the quotation marks) from the workbook. In Microsoft Excel, you can check the name of a defined name by using Visual Basic for Applications macro code similar to the following:

MsgBox ThisWorkbook.Names(5).Name MsgBox ThisWorkbook.Names("test").Name


In Microsoft Excel, if you specify a name within the parentheses in the sample code, the Name property returns a name that is identical (in terms of case) to the name that is defined in the Define Name dialog box. In versions of Excel earlier than Excel 97, the Name property returns a name that is identical (in terms of case) to the name that you specify in the parentheses. To demonstrate the difference in behavior, run the following subroutine:

Sub TestName() MyArray = Array("test", "Test", "tEST", "TEST") For Each xName In MyArray ThisWorkbook.Names.Add Name:=xName, RefersTo:="5" MsgBox ThisWorkbook.Names("test").Name Next xName End Sub
The message boxes display different values, depending on the version of Microsoft Excel that you are using.

MsgBox Value in MsgBox Value in Defined name Microsoft Excel 97, 2000 Microsoft Excel 5.0, 7.0 ------------------------------------------------------------------ test test test Test Test test tEST tEST test TEST TEST test
This change in behavior may cause a problem if you compare the name that is returned by a Name property to a string. For example, although the following code always works in versions of Excel earlier than Excel 97, it may not work in the current version of Microsoft Excel:

MsgBox ThisWorkbook.Names("test").Name = "test"


You can prevent problems from occurring by standardizing the case of the name before you compare it. For example, the following code works correctly in any version of Microsoft Excel:

MsgBox UCase(ThisWorkbook.Names("test").Name) = UCase("test")


APPLIES TO

Microsoft Excel 2000 Standard Edition

Back to the top

Keywords: kbprb KB213533

XL2000: Detailed Solutions for Interest Rate Formulas


View products that this article applies to. Article ID : 214005 Last Review : October 8, 2003 Revision : 3.0

This article was previously published under Q214005

On This Page

SUMMARY MORE INFORMATION Definitions Formulas If Rate Is Not 0 Formulas If Rate Is 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 Microsoft Excel Help to find detailed information about one of the functions listed above, these two formulas are referenced. However, Microsoft Excel Help does not contain solutions for the individual functions. The "More Information" section of this article contains solutions for each of these functions. Back to the top

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) cash flow. Input variables must always be entered with the appropriate sign. Back to the top

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 Back to the top

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. Back to the top

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 be 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). Back to the top

How Excel works with two-digit year numbers


View products that this article applies to. Article ID : 214391 Last Review : January 24, 2007 Revision : 6.1

This article was previously published under Q214391

On This Page

SUMMARY MORE INFORMATION Using the Regional Settings in Control Panel The 2029 Rule Entering Dates That Contain Only Day/Month or Month/Year Components REFERENCES

SUMMARY
When you type a date using a two-digit year number (such as 98), Microsoft Excel uses specific rules to determine which century to use for the date. This article explains how Microsoft Excel determines the century. Back to the top

MORE INFORMATION
When you type a date in a cell, if you omit the century digits from the year, Excel automatically determines which century to use for the date. For example, if you type 7/5/98, Excel automatically uses the year 1998 and changes the date to 7/5/1998 in the formula bar. The following sections explain the default rules that Excel uses. Back to the top

Using the Regional Settings in Control Panel

Excel first interprets dates according to the date ordering defined by the Short date style setting under Regional Settings in Control Panel, for example, M/d/yy. If you are running Microsoft Windows 98 or later, you can use the When a two digit year is entered, interpret a year between setting under Regional Settings in Control Panel to determine the cutoff year for the century. The default value is 2029, but you can change this to any value between 99 and 9999. Note You can change the When a two digit year is entered, interpret a year between setting to a value that is not compatible with Excel. If you enter an incompatible value, Excel will revert to the rules discussed in the "The 2029 Rule" section of this article. To change the century cutoff date, follow these steps: 1. Click Start, point to Settings, and then click Control Panel. 2. Double-click the Regional Settings icon. 3. Click the Date tab. 4. In the When a two digit year is entered, interpret a year between box, type the cutoff year that you want, and then click OK. The following table illustrates the effect that various cutoff years will have when you type a two-digit year in Excel:

Regional Settings Setting Date typed Date used ------------------------------------------ 2039 9/7/70 9/7/1970 2039 2/3/27 2/3/2027 2075 9/7/70 9/7/2070 2099 2/3/27 2/3/2027
Note This will modify the way Excel interprets dates only when they are typed into a cell. If you import or programmatically enter a date, the following 2029 rule is always in effect. Back to the top

The 2029 Rule


By default, Excel determines the century by using a cutoff year of 2029, which results in the following behavior: Dates in the inclusive range from January 1, 1900 (1/1/1900) to December 31, 9999 (12/31/9999) are valid. When you type a date that uses a two-digit year, Excel uses the following centuries:

Two-digit year typed Century used --------------------------------00-29 21st (year 2000) 30-99 20th (year 1900)
For example, when you type the following dates, Excel interprets these as follows:

Date typed Date used ------------------------- 7/4/00 7/4/2000 1/1/10 1/1/2010 12/31/29 12/31/2029 1/1/30 1/1/1930 7/5/98 7/5/1998 12/31/99 12/31/1999
If you want to type a date that is before January 1, 1930, or after December 31, 2029, you must type
the full four-digit year. For example, to use the date July 4, 2076, type 7/4/2076. Back to the top

Entering Dates That Contain Only Day/Month or Month/Year Components


So far, this article has discussed how Excel interprets three-part date entries that contain month, day, and year components. It is possible to enter a two-part date that contains only the day and month, or the month and year components of the date. Two-part dates are inherently ambiguous and should be avoided if possible. This section discusses how Excel handles date entries that contain only two parts. When you enter a date that contains only two of the three date components, Excel assumes that the date is in the form of Day/Month or Month/Year. Excel first attempts to resolve the entry as a Day/Month entry in the current year. If it cannot resolve the entry in the Day/Month form, Excel attempts to resolve the entry in the Month/Year form, using the first day of that month. If it cannot resolve the entry in the Month/Year form, Excel interprets the entry as text.

The following table illustrates how Excel interprets various date entries that contain only two of the three date components. Note This table assumes that the current year is 1999.

Entry Resolution ----- ---------- 12/01 12/1/1999 12/99 12/1/1999 11/95 11/1/1995 13/99 13/99 (text) 1/30 1/30/1999 1/99 1/1/1999 12/28 12/28/1999
Note This table illustrates how Excel stores the date, not how the date is displayed in the cell. The display format of the date varies according to the date formats that have been applied to the cell, and the current settings under Regional Settings in Control Panel. Back to the top

REFERENCES
For more information about how earlier versions of Excel work with two-digit year numbers, click the article number below to view the article in the Microsoft Knowledge Base: 302768 How Microsoft Excel works with two-digit year numbers Back to the top

APPLIES TO

Microsoft Office Excel 2007 Microsoft Office Excel 2003 Microsoft Excel 2002 Standard Edition Microsoft Excel 2000 Standard Edition, when used with: Microsoft Windows Server 2003, Enterprise Edition (32-bit x86) Microsoft Windows Server 2003, Standard Edition (32-bit x86) Microsoft Windows XP Home Edition Microsoft Windows XP Professional Microsoft Windows 2000 Server Microsoft Windows 2000 Professional Edition Microsoft Windows Millennium Edition Microsoft Windows 98 Second Edition

Back to the top

Keywords: kbhowto KB214391


Back to the top

Description of how Excel determines the current mode of calculation


View products that this article applies to. Article ID : 214395 Last Review : January 24, 2007 Revision : 5.1

This article was previously published under Q214395

On This Page

SUMMARY MORE INFORMATION How to control the mode of calculation Recalculate the active sheet Recalculate all open documents

How to change the mode of calculation in Excel 2007 How to change the mode of calculation in Excel 2003 and in earlier versions of Excel

SUMMARY
In Microsoft Excel, all currently open documents use the same mode of calculation, regardless of the mode in which they have been saved. Back to the top

MORE INFORMATION
To help explain how the mode of calculation is determined, this article refers to the following hypothetical documents:

Saved with this File name Type of document mode of calculation ------------------------------------------------------ Auto1.xls Workbook Automatic Manual1.xls Workbook Manual Auto2.xls Workbook Automatic
The following statements apply to calculation modes in Excel: The first document opened uses the calculation mode with which it was last saved. Subsequently opened documents use the same mode. For example, if you open Auto1.xls and then open Manual1.xls, both documents use automatic calculation (the mode used by Auto1.xls). If you open Manual1.xls and then open Auto1.xls, both documents use manual calculation. Changing the calculation mode of one open document changes the mode for all open documents. If Auto1.xls and Auto2.xls are both open, changing the calculation mode of Auto2.xls to manual also changes the mode of Auto1.xls to manual. All sheets contained in a workbook use the same mode of calculation. If Auto2.xls contains three worksheets, changing the mode of calculation of the first worksheet to manual also changes the mode of calculation to manual in the other two sheets. If all other documents are closed and you create a new document, the new document uses the same calculation mode as the previously closed documents. However, if you use a template, the mode of calculation is the mode that is specified in the template. If the mode of calculation in a workbook has changed and the file is saved, the current mode of calculation is saved. If Auto1.xls is opened, Manual1.xls is opened, and Manual1.xls is immediately saved, the mode of calculation is saved as automatic. Back to the top

How to control the mode of calculation


All open documents use the same mode of calculation. You must follow special procedures 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.

Close Auto1.xls (and any other open documents) before you open Manual1.xls. There are four modes of calculation that you can select in Microsoft Office Excel and in earlier versions of Excel. These modes are as follows: Automatic Automatic except tables Manual Recalculate before save
In Microsoft Office Excel 2007, the four modes of calculation are as follows: Automatic

Automatic except for data tables Manual

Recalculate workbook before saving

For this mode Recalculation occurs when ------------------------------------------------------------------Automatic You make any change to the document. All affected parts of the document are recalculated. Automatic You make any change 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 press the F9 key, click Options on the Tools menu, click the Calculation tab, and click the Calc Sheet button. Manual / You press F9, or click Calc Sheet on the Recalculate before Calculation tab on the Tools/Options menu, as Save well as every time you save the file.
Back to the top

Recalculate the active sheet


To recalculate only the active sheet, use one of the following methods:

Press SHIFT+F9. In Excel 2003 and in earlier versions of Excel, click Options on the Tools menu, and then click the
Calculation tab. Click the Calc Sheet button to calculate only the active sheet. In Excel 2007, click Calculate Sheet on the Formulas menu in the Calculation group. Back to the top

Recalculate all open documents


To recalculate all open documents, use one of the following methods:

Press F9. In Excel 2003 and in earlier versions of Excel, click Options on the Tools menu, click the
Calculation tab, and then click the Calc Now button. In Excel 2007, click Calculate Now on the Formulas menu in the Calculation group. Back to the top

How to change the mode of calculation in Excel 2007


2. 1. Click the Microsoft Office Button, and then click Excel Options. On the Formulas tab, select the calculation mode that you want to use. Back to the top

How to change the mode of calculation in Excel 2003 and in earlier versions of Excel
2. 1. Click Options on the Tools menu, and then click the Calculation tab. Under Calculation, click the calculation mode that you want to use. Back to the top

APPLIES TO

Microsoft Office Excel 2007 Microsoft Office Excel 2003 Microsoft Excel 2002 Standard Edition Microsoft Excel 2000 Standard Edition Microsoft Excel 97 Standard Edition

Back to the top

Keywords: kbhowto kbinfo KB214395

XL2000: Inserting and Formatting Text in Headers and Footers


View products that this article applies to. Article ID : 213618 Last Review : October 11, 2006 Revision : 4.2

This article was previously published under Q213618

On This Page

SUMMARY MORE INFORMATION Formatting Codes for Headers and Footers Sample Visual Basic Procedure REFERENCES

SUMMARY
In Microsoft Excel, you may want to use a header or footer in a worksheet. The "More Information" section of this article discusses the formatting codes that you can use to automatically insert and format text in a header or footer, and it also contains a sample Microsoft Visual Basic for Applications macro that you can used to add and format text in the header and footer of a worksheet. Back to the top

MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Back to the top

Formatting Codes for Headers and Footers


To use multiple lines in a header, use either of the following methods:

Use CHR(10) to insert a linefeed character. Use CHR(13) to insert a carriage return character.
Note that you cannot record these characters in a macro. The following tables contain the format codes that you can use in headers and footers.

Codes to format text -------------------------------------------------------------------- &L Left-aligns the characters that follow. &C Centers the characters that follow. &R Right-aligns the characters that follow. &E Turns doubleunderline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &"fontname" Prints the characters that follow in the specified font. Be sure to include the quotation marks around the font name. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points.

Codes to insert specific data ------------------------------------------------------------------- &D Prints the current date &T Prints the current time &F Prints the name of the document &A Prints the name of the workbook tab (the "sheet name") &P Prints the page number &P+number Prints the page number plus number &P-number Prints the page number minus number && Prints a single ampersand &N Prints the total number of pages in the document
Back to the top

Sample Visual Basic Procedure


Note that the following code samples assume that the list has a header row starting in cell A1 and data starting in A2. Note also that the "~" indicates a step to be performed on each line of the loop, or at a specified time. To create a sample macro that uses some of the formatting codes: 1. Open a new workbook. 2. Insert a module sheet into the workbook. Point to Macro on the Tools menu, and click Visual Basic Editor. In the Visual Basic Editor, click Module on the Insert menu. 3. Type the following macro on the module sheet:

Sub Format_Codes() 'The line below will print the words "header text" underlined 'and in font size 24. Even though the CenterHeader is 'indicated, the "&L" will force it to the left. ActiveSheet.PageSetup.CenterHeader = "&L&U&24header text" 'This line of code will format the words, "my text", in the 'font Arial and use Bold. Notice that each piece is enclosed in 'quotation marks. ActiveSheet.PageSetup.RightHeader = "&""arial,bold""my text" 'To get more than one line, concatenate the linefeed or return 'character into the string. ActiveSheet.PageSetup.CenterHeader = "First line" & Chr(13) & _ "Second line" 'The following will put the current date in the left footer, 'the file name in the center footer and the number of pages and 'the total number of pages in the right footer. The last uses 'simple concatenation to achieve the desired result. With ActiveSheet.PageSetup .LeftFooter = "&D" .CenterFooter = "&F" .RightFooter = "Page " & "&P" & " of " & "&N" End With End Sub
NOTE: To type a format code, enclose it in quotation marks. To use the format code for font type, enclose the name in two sets of quotation marks (for example, type ""Arial""). You can also format user-supplied text. 4. Return to Sheet1 and run the Format_Codes macro created in step 3. 5. To view the results, click the Print Preview button on the Standard toolbar, or click Print Preview on the File menu. For additional information, please click the article number below to view the article in the Microsoft Knowledge Base: 213633 XL2000: How to Display Quotation Marks in Function Results and Macros Back to the top

REFERENCES
For more information about formatting headers and footers, click Microsoft Excel Help on the Help menu, type custom header in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. Back to the top

APPLIES TO

Microsoft Excel 2000 Standard Edition

Back to the top

Keywords: kbdtacode kbfaq kbhowto kbprogramming kbualink97 KB213618

XL2000: Keeping a Cumulative Total in a Column or Row


View products that this article applies to. Article ID : 214149 Last Review : September 27, 2003 Revision : 3.0

This article was previously published under Q214149

SUMMARY
In Microsoft Excel 2000, you can calculate a cumulative total in a column or row of cells by using a combination of absolute and relative references in a SUM() formula.

MORE INFORMATION
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; and so on), follow these steps: 1. Start Excel and open a new workbook. 2. In cell B1 type the following formula: =SUM($A$1:A1) 3. Select cells B1 through B10. 4. On the Edit menu, point to Fill, and then click Down. The $A$1 (absolute reference) is constant in each cell, although the A1 (relative reference) is updated in each successive cell to refer to the adjacent cell in column A. 5. Type the following data into the worksheet:

A1: 1 A2: 6 A3: 77 A4: 94 A5: 32 A6: 44 A7: 33 A8: 22 A9: 6 A10: 5
6. The cells in column B return the following data:

B1: 1 B2: 7 B3: 84 B4: 178 B5: 210 B6: 254 B7: 287 B8: 309 B9: 315 B10: 320
TIP: To calculate a running average of the numbers in column A, replace SUM with AVERAGE in the formulas.

APPLIES TO

Microsoft Excel 2000 Standard Edition

Back to the top

Keywords: kbhowto KB214149

Overview of the built-in chart types in Excel


View products that this article applies to. Article ID : 211951 Last Review : January 24, 2007 Revision : 4.1

This article was previously published under Q211951

On This Page

SUMMARY MORE INFORMATION Area Chart Bar Chart Column Chart Line Chart Pie Chart XY (Scatter) Chart Doughnut Chart Radar Chart Surface Chart Bubble Chart Stock Chart Cone, Cylinder, and Pyramid Chart Types REFERENCES

SUMMARY
This article describes the types and subtypes of the charts. It also describes what type of data each chart best represents. Back to the top

MORE INFORMATION
Area Chart
An area chart emphasizes the magnitude of change over time. By displaying the sum of the plotted values, an area chart also shows the relationship of parts to a whole. Back to the top

Bar Chart
A bar chart illustrates comparisons among individual items. Categories are organized vertically, values horizontally, to focus on comparing values and to place less emphasis on time. Stacked bar charts show the relationship of individual items to the whole. A 3-D bar chart emphasizes the values of individual items at a specific time or draws comparisons between items. The subtypes stacked and 100- percent stacked bar charts show relationships to a whole. Back to the top

Column Chart
A column chart shows data changes over a period of time or illustrates comparisons among items. Categories are organized horizontally, values vertically, to emphasize variation over time. Stacked column charts show the relationship of individual items to the whole. A 3-D column chart shows a 3-D view of a column chart in one of two variations: simple 3-D and 3-D perspective. The simple 3-D column displays the column markers along the x (or category) axis. The 3D perspective chart compares data points along two axes: the x axis and the y (or series) axis. In both chart variations, the data series are plotted along the z axis. This chart type allows you to compare data within a data series more easily and still be able to view the data by category. Back to the top

Line Chart
A line chart shows trends in data at equal intervals. Although line charts are similar to area charts, line charts emphasize time flow and the rate of change, rather than the amount of change or the magnitude of values. A 3-D line chart shows a 3-D view of a line chart as 3-D ribbons. This chart type is often used to display data attractively for presentations. Back to the top

Pie Chart
A pie chart shows the proportional size of items that make up a data series to the sum of the items. It always shows only one data series and is useful when you want to emphasize a significant element. To make small slices easier to see, you can group them together as one item in a pie chart and then break down that item in a smaller pie or bar chart next to the main chart. Back to the top

XY (Scatter) Chart
An xy (scatter) chart either shows the relationships among the numeric values in several data series or plots two groups of numbers as one series of xy coordinates. It shows uneven intervals, or clusters, of data and is commonly used for scientific data. When you arrange your data, place x values in one row or column, and then enter corresponding y values in the adjacent rows or columns. Back to the top

Doughnut Chart
Like a pie chart, a doughnut chart shows the relationship of parts to a whole, but it can contain more than one data series. Each ring of the doughnut chart represents a data series. Back to the top

Radar Chart
In a radar chart, each category has its own value axis radiating from the center point. Lines connect all the values in the same series. A radar chart compares the aggregate values of a number of data series. Back to the top

Surface Chart
A surface chart is useful when you want to find optimum combinations between two sets of data. As in a topographic map, colors and patterns indicate areas that are in the same range of values. A 3-D surface chart shows a 3-D view of what appears to be a rubber sheet stretched over a 3-D column chart. Surface charts are useful for finding the best combinations between two sets of data. This chart can be used to show relationships between large amounts of data that may otherwise be difficult to see. As in topographic maps, colors or patterns indicate areas that are of the same value. The colors do not mark the data series. The wire frame format displays the data in black and white. The contour chart formats provide a 2-D view of the data from above, similar to a 2-D topographic map. Back to the top

Bubble Chart
A bubble chart is a type of xy (scatter) chart. The size of the data marker indicates the value of a third variable. To arrange your data, place the x values in one row or column, and enter corresponding y values and bubble sizes in the adjacent rows or columns. Back to the top

Stock Chart
The stock chart is often used to illustrate stock prices. This chart can also be used for scientific data, for example, to indicate temperature changes. You must organize your data in the correct order to create this and other stock charts. A stock chart that measures volume has two value axes: one for the columns that measure volume, the other for the stock prices. You can include volume in a high-low-close or open-high-low-close chart. Back to the top

Cone, Cylinder, and Pyramid Chart Types


The cone, cylinder, and pyramid data markers can lend a dramatic effect to 3-D column and bar charts. Back to the top

REFERENCES

For more information about chart types, click Microsoft Excel Help on the Help menu, type Examples of chart types in the Office Assistant or the Answer Wizard, and then click Search to view the topic. Back to the top

APPLIES TO

Microsoft Office Excel 2007 Microsoft Office Excel 2003 Microsoft Excel 2002 Standard Edition Microsoft Excel 2000 Standard Edition

Back to the top

Keywords: kbchart kbhowto KB211951


Back to the top

XL2000: Private Functions Are Available to Worksheet


View products that this article applies to. Article ID : 199200 Last Review : September 12, 2006 Revision : 3.2

This article was previously published under Q199200

SYMPTOMS
When you create a user-defined function in Microsoft Visual Basic for Applications, you can use the function in the worksheet even though you have declared it as Private or you have used Option Private Module. Back to the top

CAUSE
This problem occurs when you do the following: You use the Private Function statement. -orYou use the Option Private Module statement. Back to the top

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. Back to the top

MORE INFORMATION
You can create a user-defined function and make it private to the subroutine by using the statement Private Function name. Or, you can make it private to the module by using the statement Option Private Module. Although you can manually enter a private user-defined function into a worksheet cell, the function is not listed in the User-defined function category in the Paste Function dialog box.

NOTE: A function listed as Private will not conflict with built-in functions or defined names with the same name. Back to the top

APPLIES TO

Microsoft Excel 2000 Standard Edition

Back to the top

Keywords: kbbug kbpending KB199200

How to reset the last cell in Excel


View products that this article applies to. Article ID : 244435 Last Review : January 11, 2007 Revision : 5.1

This article was previously published under Q244435

On This Page

SUMMARY MORE INFORMATION Method 1: Manually delete excess rows and columns Method 2: Use an Excel add-in Microsoft Office Excel 2007 Microsoft Office Excel 2003 and earlier versions of Excel

SUMMARY
Microsoft Excel saves only the part of each worksheet that is in use, meaning the section that contains data or formatting. Sometimes the last cell of a worksheet may be beyond the range of your actual used data. This issue may cause you to have a larger file size than neccesary, you may print extra pages, you may receive "Out of Memory" error messages, or you may experience other unusual behavior. Clearing the excess rows and columns to reset the last cell can help to resolve these issues. Note You can locate the last cell of the active worksheet by pressing CTRL+SHIFT+END. Back to the top

MORE INFORMATION
The most common cause of the last cell being set outside the worksheet range that is currently in use is excessive formatting. When you format whole rows and columns, some types of formatting can cause the last cell to be set to a cell far below or to the right of the actual range that is in use. This issue may also occur when you import a Lotus 1-2-3 file into Excel. When you save the Lotus file to the Excel Workbook format, Excel cannot determine the last cell in the Lotus 1-2-3 worksheet. Therefore, it makes the whole worksheet active. To reset the last cell address, you can use either of the following methods to clear the unnecessary information (data and formatting) from the unused columns and rows of the worksheet. After you remove the extraneous information, save the sheet to force Excel to rebuild the active cell table. Note When you use either of the following methods, you may receive an "Out of Memory" error message or a similar error message. This is because Excel tries to delete the selected range. If you receive this error message, use smaller row or column ranges when you clear data. Back to the top

Method 1: Manually delete excess rows and columns

To reset the last cell by manually deleting excess rows and columns, follow these steps: 1. Select all columns to the right of the last column that contains data by selecting the appropriate column headings. Tip One way to do this is to press F5 and type the appropriate reference. For example, type F:IV for columns, or type 5:65536 for rows. Press DELETE. Repeat steps 1 and 2 for the rows that are under the last row that contains data. Save the file. To continue working in the file, close and then reopen the file. Back to the top

2. 3. 4. 5.

Method 2: Use an Excel add-in


An Excel add-in that removes excess formatting and resets the last cell is now available for download. To download this add-in, visit the following Microsoft Web site: http://www.microsoft.com/downloads/details.aspx?FamilyId=ECFD076C-B873-48CC-B842DA999C848C82&amp;displaylang=en 1. On the download page, click the Download button. When you are prompted to do so, click Open. 2. When you receive the licensing agreement, click Yes. 3. When you receive the WinZip Self-Extractor prompt, click the Browse button, and then select the location where you want the add-in to be extracted. Note You can put the file in the Excel add-in location, where it will automatically show up in the Addins dialog box in Excel. That location is the Library folder in the Office install location. Typically, this location is the C:\Program Files\Microsoft Office\Office\Library folder. After you select the download location that you want in the Browse dialog box, click UnZip in the WinZip dialog box. Click OK on the successful download prompt, and then click Close in the WinZip dialog box. 4. Start Excel, and then follow these steps, as appropriate for the version of Excel that you are running.

Microsoft Office Excel 2007


a. Click the Microsoft Office Button, and then click Excel Options. b. Click Add-Ins, click Excel Add-ins in the Manage box, and then click Go. c. If you did not save the file to the Library folder, click the Browse button, locate the file, and then select the file in the Browse window. d. Click Excess Format Cleaner 1.1, and then click OK.

Microsoft Office Excel 2003 and earlier versions of Excel


a. Click Add-Ins on the Tools menu. If you did not save the file to the Library folder, click the Browse button, locate the file, and then select the file in the Browse window. c. Click Excess Format Cleaner 1.1, and then click OK. 5. In Excel 2007, click the Add-Ins tab, and then click Clear Excess Formats in XSFormatCleaner.xla in the Menu Commands group. b. In Excel 2003 and in earlier versions of Excel, open the workbook that you want to clean up, and then click Clear Excess Formatting in workbook on the File menu. The macro will then clear excess formatting from all worksheets in the file. When the macro is completed, you will be informed that you must save the workbook for the changes to be permanent. 6. Save, close, and then reopen the file. Back to the top

APPLIES TO

Microsoft Office Excel 2007 Microsoft Office Excel 2003 Microsoft Excel 2002 Standard Edition

Microsoft Excel 2000 Standard Edition Microsoft Excel 97 Standard Edition

Back to the top

Keywords: kbexpertisebeginner kbcode kbdtacode kbhowto kbinfo kbprogramming KB244435

Description of digital signatures in Excel 2002 workbooks


View products that this article applies to. Article ID : 288985 Last Review : January 31, 2007 Revision : 1.3

This article was previously published under Q288985 For a Microsoft Excel 2003 version of this article, see 820738.

On This Page
SUMMARY MORE INFORMATION What Is a Digital Certificate? What Is a Signature? What Happens When I Use a Digital Signature? What Excel Files Can I Sign? How Can I Obtain a Signature? To Install the SelfCert Tool To Create a Test Certificate How Do I Sign a Workbook? REFERENCES

SUMMARY
In Microsoft Excel 2002, you can digitally sign a workbook. Doing so ensures that you were the last person to make changes to the workbook. Earlier versions of Microsoft Excel support digitally signing Microsoft Visual Basic for Applications (VBA) macro projects. For more information, please see the "References" section later in this article. This article discusses the following topics regarding workbook signing: What is a digital certificate?

What is a signature? What happens when I use a digital signature? What Excel files can I sign? How can I obtain a signature? How do I sign a workbook?

Back to the top

MORE INFORMATION
What Is a Digital Certificate?
Digital certificates and signatures assure you that the file that you are about to use comes from a reliable source and has not been tampered with. A digital certificate is an ID that a file carries with it. To validate a signature, a certifying authority validates information about the creator of the file and then issues the digital certificate. The digital certificate contains information about the person to whom the certificate was issued, as well as

information about the certifying authority that issued it. When a digital certificate is used to sign a file, this ID is stored with the file in a secure and verifiable form so that it can be displayed to a user. Back to the top

What Is a Signature?
Excel uses digital signatures on the workbook contents to ensure that the workbook has not been modified and saved since it was signed. Digital signatures can also help you distinguish workbooks and macros created by a reliable source from undesirable and potentially damaging workbooks or macro code (viruses). A digital signature is a public certificate plus the value of the signed data as encrypted by a private key. The value is a number that a cryptographic algorithm generates for any data that you want to sign. This algorithm makes it nearly impossible to change the data without changing the resulting value. So, by encrypting the value instead of the data, a digital signature allows a user to verify the data was not changed. NOTE: When you digitally sign a file, it is important to understand that the digital signature generated by Microsoft Office may not constitute a legally binding signature in all U.S. states, Canadian provinces, or in other countries. You should consult with the law of the appropriate jurisdiction before relying on a digital signature as a binding legal signature. You should also understand that this feature cannot in all circumstances check the validity of the digital certificate on which the digital signature is based. Therefore, it is important that you verify that the digital certificate is valid before you use it to sign a document. Back to the top

What Happens When I Use a Digital Signature?


You can view and edit signed Excel workbooks, although you cannot modify and save a signed workbook without invalidating the signature. For instance, you can sign a file and other users can view the file. As long as the file remains signed, others will know it came from you and has not been modified. Signing a workbook is different from signing a VBA Project. You can sign the workbook for content and you can also sign the VBA Project in the same workbook. Back to the top

What Excel Files Can I Sign?


You can sign any native Excel file format, including templates, as well as earlier versions of the file format, such as Excel 5/95. However, Excel 2002 is the only version of Excel that recognizes the signature. Signing a template and then creating a new workbook based upon that template results in a signed, unsaved workbook. The main purpose for signing a template is to ensure that the original template was not modified. Excel does not allow you to sign a shared workbook, because more that one person can make changes to the workbook. NOTE: In Excel, no VBA method or property is available to sign or read signature information for a workbook. Back to the top

How Can I Obtain a Signature?


To obtain a digital signature, you first need a digital certificate. You can obtain a digital certificate from a commercial certification authority or from your internal security administrator or Information Technology (IT) professional. A certification authority can issue you a digital certificate for a fee. The certification authority does an indepth identification check before it issues a digital certificate. The following companies are examples of digital certificate authorities: VeriSign, Inc.

http://www.verisign.com http://www.thawte.com Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information. You can create your own certificate for personal use or testing purposes with the SelfCert.exe tool that is provided in Office. This unauthenticated certificate allows you to sign your own workbooks. Because this type of certificate is not validated by a certification authority, other users will see a warning not to trust the workbook if it contains macros.

Thawte, Inc.

To Install the SelfCert Tool


To install the tool, follow these steps: 1. Quit all Office programs. Click Start, point to Settings, and then click Control Panel. 2. In Control Panel, double-click the Add/Remove Programs icon. 3. On the Install/Uninstall tab, click Office XP product in the list of products, where Office XP product is the version of Office that you are using. If you are using a stand-alone version of one of the Office programs, click to select the appropriate product in the list. Click Add/Remove. 4. In the Setup dialog box, click Add or Remove Features. 5. In the Microsoft Office XP: Update Features dialog box, click the plus sign (+) next to Office Shared Features to expand the features list. If you see a minus sign (-) instead, the features list is already expanded. 6. Click the arrow next to Digital Signature for VBA projects , and then click Run from My Computer in the shortcut menu. Click Update Now.

To Create a Test Certificate


To create a test certificate for use with your workbooks, follow these steps: 1. Click Start, point to Programs, and then click Windows Explorer. 2. In Windows Explorer, navigate to the path\Microsoft Office\Office10 folder, where path is the drive and folder in which you installed Office. 3. Find the SelfCert.exe program and double-click it. 4. After SelfCert starts, type your name in the Your name box, and then click OK. The program generates a digital certificate for the name that you typed. Back to the top

How Do I Sign a Workbook?


To digitally sign your workbook, follow these steps: 1. On the Tools menu, click Options. 2. On the Security tab, click Digital Signatures. 3. Click Add. If the workbook has changed and is not yet saved, or is not saved in the Excel 2002 workbook format, you receive the following message: This workbook must be saved as a Microsoft Excel workbook before it can be digitally signed. Do you want to save the workbook? If you do not save the workbook, you cannot digitally sign it. 4. Click Yes to display the Save As dialog box. You must save the file in the Microsoft Excel Workbook format to add the digital signature. 5. After you save the workbook, the Select Certificate dialog box is displayed. Click to select the certificate that you want to use and click OK. 6. Click OK to close the Digital Signatures dialog box. The Microsoft Excel title bar displays the word [Signed] in brackets after the workbook name to indicate that the workbook has been successfully signed, for example: Book1.xls [Signed] Back to the top

REFERENCES
For more information about digitally signing macros and workbooks, click Microsoft Excel Help on the Help menu, type digital signatures in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. Back to the top

APPLIES TO

Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbdigitalsignatures kbinfo KB288985

XL2002: Articles About New Formatting Features in Excel 2002


View products that this article applies to. Article ID : 293449 Last Review : January 31, 2007 Revision : 1.2

This article was previously published under Q293449

SUMMARY

Microsoft Excel 2002 offers several new formatting options for workbook and worksheet formatting: Color-coded worksheet tabs. Smart Tags Unmerge Cells button on the toolbar. Retain column widths option.

Border drawing tools. This article lists frequently asked questions and troubleshooting topics for some of the new formatting features in Excel 2002. Back to the top

MORE INFORMATION
For more information, click the article numbers below to view the articles in the Microsoft Knowledge Base.

General Topics
1. How do I make the paste options button disappear? 289577 HOW TO: Make Paste Options Disappear After You Paste in 2. How can I change the available sheet tab colors? 288412 XL2002: How to Change the Color Palette for Workbooks 3. How do I use the new border drawing tools? 288852 XL2002: How to Use Draw Border and Draw Border Grid to 4. How do I use Smart Tags? 289148 XL2002: Smart Tag Functionality 5. How do I use the new Find and Replace dialog box? 288291 XL2002: How to Use New "Find and Replace" Dialog Box in 6. How do I add an image to the header or footer? 288964 XL2002: How to Add an Image to a Worksheet's Header or Excel 2002

Apply and Remove Cell Borders

Excel 2002 Footer

Troubleshooting Help

1. Why can I only look up cells if the formatting is exactly the same? 283626 XL2002: Can Only Find Exact Matches When You Find Formats Based on a Cell 2. Why does the color palette look different? 291293 XL2002: Color Palette Looks Different in Microsoft Excel 2002 3. Why do my header/footer graphics run onto the page? 288966 XL2002: Graphics in Header or Footer Extend into Data Area of Worksheet Back to the top

REFERENCES
For more information about any of the formatting features listed in this article, click Microsoft Excel Help on the Help menu, type the feature name (such as Smart Tags) in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. Back to the top

APPLIES TO

Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbhowto KB293449

XL2002: Articles About New Printing Features in Excel 2002


View products that this article applies to. Article ID : 293447 Last Review : January 31, 2007 Revision : 1.3

This article was previously published under Q293447

SUMMARY
Print functionality in Microsoft Excel 2002 is similar to that of earlier versions of Excel. This article lists Microsoft Knowledge Base articles that address some of the more frequently asked questions concerning print features in Excel 2002. Back to the top

MORE INFORMATION
Why are my cell errors still printing after I change the Print Cell Errors As setting?
282406 XL2002: "Print Cell Errors As" Setting Is Lost When You Open and Save Workbook in Earlier Version How can I add the path to a workbook into the header or footer of my workbook? 287482 XL2002: How to Add the Workbook Path to the Header and Footer How can I add a graphic into the header or footer of my workbook? 288966 XL2002: Graphics in Header or Footer Extend into Data Area of Worksheet How can I stop errors in cells from printing? 288972 XL2002: How to Suppress the Printing of Errors in Workbook Cells Why can't I set certain page setup options for a multiple-sheet selection? 291310 Cannot Set Print Area or Print Titles How can I set up multiple views for reports? 291072 XL2002: How to Create Multiple Views and Create and Print a Report

Back to the top

REFERENCES

For more information about printing, click Microsoft Excel Help on the Help menu, type about printing in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. Back to the top

APPLIES TO

Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbhowto kbinfo KB293447

XL2002: Articles About New Security Features in Excel 2002


View products that this article applies to. Article ID : 293414 Last Review : January 31, 2007 Revision : 2.4

This article was previously published under Q293414

SUMMARY
Security in Microsoft Excel encompasses three main areas:

Protection and passwords Security levels and encryption Macro virus prevention
This article lists some of the more frequently asked questions about security in Microsoft Excel 2002. Back to the top

MORE INFORMATION
For more information, click the article numbers below to view the articles in the Microsoft Knowledge Base.

General Topics
1. Why isn't my personal data being removed when I save my workbook? 284880 XL2002: Personal Data Is Not Removed as Expected When File Is Saved 2. How is Excel impacted if I install Microsoft Office without Microsoft Visual Basic for Applications (VBA)? 282847 XL2002: Excel Functionality Missing When VBA Is Not Enabled 3. Why isn't my personal data removed from the objects in my workbook? 278579 OFFXP: "Remove Personal Information" Option Does Not Apply to Inserted Objects 4. Why do I get a #NAME error when I open my workbook? 277608 XL2002: Macro High Security Warning or User Defined Functions Display #Name? 5. Why do I get an error message when I try to edit cells? 277615 XL2002: Error Message When You Attempt to Edit Multiple Cells in a Protected Worksheet with a Single Password 6. What is a digital signature? 288985 XL2002: About Digital Signatures in Excel Workbooks Back to the top

REFERENCES
For more information about worksheet and workbook security, click Microsoft Excel Help on the Help menu, type security in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. Back to the top

APPLIES TO

Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbdtacode kbfaq kbinfo KB293414

Articles about troubleshooting errors in worksheets in Excel


View products that this article applies to. Article ID : 293412 Last Review : January 31, 2007 Revision : 4.1

This article was previously published under Q293412

On This Page

SUMMARY MORE INFORMATION General troubleshooting Formula auditing REFERENCES

SUMMARY
It can be challenging to find the cause of error messages in Microsoft Excel worksheets. This article lists many Microsoft Knowledge Base articles about troubleshooting error messages in Excel worksheets. Back to the top

MORE INFORMATION
General troubleshooting
Why don't my errors get flagged when my workbook is protected?
279306 XL2002: Error Checking Not Available When Workbook Is Protected or Shared Why aren't my array formulas flagged when they contain errors? 282163 XL2002: Ignored Error Flag Reappears When Worksheet Is Copied Why are cells removed from the watch window? 282158 XL2002: Array Formula with Error Not Flagged

Back to the top

Formula auditing
How do I use the Formula Evaluator?
282160 How do 289245 How do 282140 XL2002: Cell Is Removed from Watch Window When You Cut and Paste into a Watched Cell I remove the error tracing arrows? HOW TO: Use the Excel Formula Evaluator in Excel 2002 I use the Error Checking smart tag? XL2002: Cannot Remove Error Tracing Arrow

Back to the top

REFERENCES
291361 HOW TO: Use the Error Checking Options Button in Excel 2002

Frequently asked questions about workbook protection in Excel


View products that this article applies to. Article ID : 293445 Last Review : January 31, 2007 Revision : 3.1

This article was previously published under Q293445

SUMMARY
Microsoft Excel provides multiple layers of protection to allow you to control who can access and change your data. These layers of protection are as follows: Worksheet protection: You can protect elements on a worksheet (for example, cells with formulas) from all user access, or you can grant individual users access to the ranges that you specify. Workbook-level protection: You can apply protection to workbook elements, and you can protect a workbook file from being viewed and edited. If a workbook is shared, you can protect it from being returned to exclusive use and prevent the change history from being deleted.

MORE INFORMATION
The following articles address some of the more frequently asked questions about workbook and worksheet protection in Excel: How can I grant only a few users access to a range in my worksheet? 289270 How to apply different passwords or permissions to separate ranges in worksheets in Excel Why are users not allowed to edit the ranges that I established permissions for? 277613 XL2002: Protected Ranges Not Adjusted When You Edit in Previous Versions of Excel Why don't the permissions that I set on ranges in my worksheets carry over to Windows 98 computers? 283665 XL2002: Password Required to Edit a Range Protected with NT Permissions

APPLIES TO

Microsoft Office Excel 2007 Microsoft Office Excel 2003 Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbhowto kbinfo KB293445

Frequently asked questions about using links in Excel 2002 and in later versions of Excel
View products that this article applies to. Article ID : 293418 Last Review : January 31, 2007 Revision : 2.1

This article was previously published under Q293418

On This Page
SUMMARY

MORE INFORMATION General Troubleshooting

SUMMARY
In Microsoft Excel 2002 and in later versions of Excel, a link can be any of the following items:

A reference to another workbook (sometimes called an external reference) A link to another program (sometimes called a remote reference) A link to data on the Internet, the World Wide Web, or your company intranet
Because data in another workbook, another program, or on the Internet may change and outdate the data in your workbook, there are options for controlling the updating of links. This article lists some frequently asked questions and troubleshooting tips about how to use links in Excel 2002 and in later versions of Excel. The article also includes corresponding Microsoft Knowledge Base articles. Back to the top

MORE INFORMATION
General
How do I check the status of the external links in my workbook?
288940 How to check and manage the status of links in Excel 2002 or later versions of Excel How do I turn off the reminder message to update links in my workbook? 826921 How to control the startup message about updating linked workbooks in Excel 2002 and in later versions of Excel How do I prevent the automatic creation of hyperlinks? 291209 How to prevent the automatic creation of hyperlinks

Back to the top

Troubleshooting
Why am I still prompted to update links after I've broken the links in my workbook in Excel 2002
and in Microsoft Office Excel 2003? 288853 Defined name not removed when you break a link Why do I receive an error message when I open a linked workbook? 291084 Error opening workbook containing links to HTML workbook

Back to the top

APPLIES TO

Microsoft Office Excel 2003 Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbhowto kbinfo KB293418

XL2002: Frequently Asked Questions About Web Publishing in Excel 2002


View products that this article applies to. Article ID : 293416 Last Review : January 31, 2007 Revision : 1.3

This article was previously published under Q293416

SUMMARY
You can save a Microsoft Excel 2002 workbook, or part of the workbook (such as a single item on a worksheet), as a Web page and make it available on an HTTP site, an FTP site, a Web server, or a network server for users to view or interact with. This article lists a number of articles that address frequently asked questions about Web publishing in Excel 2002. Back to the top

MORE INFORMATION
Why doesn't the Web Page Preview feature work?
287116 XL2002: Web Page Preview Does Not Work 289259 XL2002: How to Save an Excel Worksheet as a Web Page or Web Part 289260 HOW TO: Save a Workbook as a Web Page in Excel 2002

How do I save my entire workbook as a Web page? How can I publish my worksheet to an FTP site?
Back to the top

REFERENCES
290298 OFFXP: How to Publish a Web Document to an FTP Site Back to the top

APPLIES TO

Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbhowto kbinfo KB293416

Frequently asked questions about Web queries in Excel


View products that this article applies to. Article ID : 293415 Last Review : January 31, 2007 Revision : 2.1

This article was previously published under Q293415

On This Page

SUMMARY MORE INFORMATION Troubleshooting

SUMMARY
Web pages often contain information that is ideal for analysis in Microsoft Excel. For example, you can analyze stock quotes in Excel by using information that comes directly from a Web page. Depending on your needs, you can retrieve data that you can update or you can obtain data from a Web page and keep it static on the worksheet. This article lists some of the more frequently asked questions about how to use Web queries in Microsoft Excel , as well as the corresponding Microsoft Knowledge Base articles. Back to the top

MORE INFORMATION

You can create or run a Web query to retrieve text or data on a Web page. Web queries are especially useful for retrieving data that is in tables or preformatted areas. (Tables are defined with the HTML [TABLE] tag; pre-formatted areas are often defined with the HTML [PRE] tag.) The retrieved data does not include pictures, such as Graphics Interchange Format (GIF) images, and does not include the contents of scripts. Note If you retrieve data from a Web site, it is your responsibility to make sure that you use the data in compliance with any applicable terms and conditions governing the use of the data by the owner and/or operator of such Web site. Back to the top

Troubleshooting
Why can't I refresh my Web query?
277596 Error message when you update a data query on your Excel worksheet: "This Web query returned no data" Why do the links that I click on in the Web query window open in a new browser window? 277864 A Web page is opened in a new browser window when you click a link in the Web Query dialog box in Excel Why does my Web query return the wrong table? 277899 Web query imports data from a table that you did not select How do I prevent the numbers in my Web queries from being formatted as dates? 287027 Web query converts numbers that contain hyphens into dates Why don't the table markers appear in the Web query dialog box for some Web pages? 277612 Table markers do not appear when you perform a Web query on a secure site

Back to the top

APPLIES TO

Microsoft Office Excel 2007 Microsoft Office Excel 2003 Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbquery kbweb kbfaq kbinfo KB293415

XL2002: Keyboard Shortcuts for Applying Borders to Cells


View products that this article applies to. Article ID : 300169 Last Review : January 31, 2007 Revision : 1.1

This article was previously published under Q300169

SUMMARY
This article contains the keyboard shortcuts that you can use to create borders on the Borders tab of the Format Cells dialog box. (Press CTRL+1 to display the dialog box.) Back to the top

MORE INFORMATION
The following table lists the keyboard shortcuts that you can use on the Borders tab of the Format Cells dialog box. Shortcut key Result

ALT+T ALT+B ALT+L ALT+R ALT+D ALT+U ALT+H ALT+V

Apply or remove the top border. Apply or remove the bottom border. Apply or remove the left border. Apply or remove the right border. Apply or remove the downward diagonal border. Apply or remove the upward diagonal border. Apply or remove the horizontal interior border. Apply or remove the vertical interior border.

Back to the top

REFERENCES
For more information about these and other keyboard shortcuts, click Microsoft Excel Help on the Help menu, type shortcuts in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned. Back to the top

APPLIES TO

Microsoft Excel 2002 Standard Edition

Back to the top

Keywords: kbenable kbhowto KB300169

Вам также может понравиться