11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3: Working with Names 75<br />

After defining the name, you can use it in a formula. The following formula, for example, returns<br />

the sum of all values in column B:<br />

=SUM(DailySales)<br />

Names created by Excel<br />

Excel creates some names on its own. For example, if you set a print area for a sheet, Excel creates<br />

the name Print_Area. If you set repeating rows or columns for printing, you also have a<br />

worksheet-level name called Print_Titles. When you execute a query that returns data to a worksheet,<br />

Excel assigns a name to the data that is returned. Also, many of the add-ins that ship with<br />

Excel create hidden names. (See the “Hidden names” sidebar.)<br />

You can modify the reference for any of the names that Excel creates automatically, but make<br />

sure that you understand the consequences.<br />

Hidden names<br />

Some Excel macros and add-ins create hidden names. These names exist in a workbook but<br />

don’t appear in the Name Manager dialog box or the Name box. For example, the Solver add-in<br />

creates a number of hidden names. Normally, you can just ignore these hidden names. However,<br />

sometimes these hidden names create problems. If you copy a sheet to another workbook, the<br />

hidden names are also copied, and they may create a link that is very difficult to track down.<br />

Unfortunately, Excel’s Name Manager doesn’t display hidden names. Here’s a simple Visual Basic<br />

for Applications (VBA) procedure that lists all hidden names in the active workbook. The macro<br />

adds a new worksheet, and the list is written to that worksheet.<br />

Sub ListHiddenNames()<br />

Dim n As Name, r As Long<br />

Worksheets.Add<br />

r = 1<br />

For Each n In ActiveWorkbook.Names<br />

If Not n.Visible Then<br />

Cells(r, 1) = n.Name<br />

Cells(r, 2) = “’” & n.RefersTo<br />

r = r + 1<br />

End If<br />

Next n<br />

End Sub

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!