Excel User Tips - Misscellaneous
Excel User Tips - Misscellaneous
Excel User Tips - Misscellaneous
• If you have a wheel mouse, press Ctl and spin the wheel to change the text size.
Make sure that the text window, not the contents window, is active.
• If you don't have a wheel mouse, activate Internet Explorer and use the View -
Text Size command to change the size of the text. Close Excel help and re-open
it and it will display the text size you specified.
In Excel, every workbook has 256 columns and 65,526 rows. Versions prior to Excel 97
have only 16,384. These values are fixed and cannot be changed. Despite what must
amount to thousands of requests, Microsoft refuses to increase the size of a worksheet.
If you need more rows, you might want to consider using a database (such as Access)
or another spreadsheet (Quattro Pro can handle a million rows) for data storage. In
most cases, you probably don't need to work with all of your data at once. You'll usually
need only a subset of your data. You can use Excel's Data, Get External Data command
to query the database and bring in only the records you need.
First, remember that passwords are case-sensitive. So if you originally entered your
password as Xyzzy, typing xyzzy won't work.
If you know you're entering the password correctly, then it's time to start looking for a
password recovery utility. Several utilities exist, and a partial list is available here.
By the way, the fact that these products exist might raise some alarms for the security-
minded. Bottom line? Excel password protection isn't as secure as you might expect.
If so, you need to create a workspace file. Before you quit for the day, select Files, Save
Workspace and specify a file name. To pick up where you left off in the last session,
reopen the workspace file: Use File, Open and choose the workspace file (it'll have an
.xlw extension).
Note: A workspace file contains only configuration information, not the actual
workbooks and worksheets. Therefore, you can't simply copy the workspace file -- you'll
need the workbook files, too.
Excel 2000 (and later) makes the process much easier. You might expect to see this
feature on the File menu, but instead you select Data, Get External Data, Import Text
File. This command calls up a dialog box in which you select a text file, whereupon the
Text Import Wizard lets you specify how Excel should import the data. Finally, in the
Import Data dialog box, you indicate the desired worksheet destination.
Excel imports the text file as a database query, which you can update if the data in the
text file changes (select Data, Refresh Data to do so). To import the file as static data,
click Properties in the Import Data dialog, and remove the check mark from the "Save
query definition" box.
Note: If you're using Excel 2002, you can turn automatic hyperlinks on or off in the
AutoCorrect dialog box
To create the macro, press Alt-F11 to activate the Visual Basic Editor, select Insert,
Module to insert a new VBA module into your project, and then enter the following
code:
Sub ZapHyperlinks()
Cells.Hyperlinks.Delete
End Sub
When you execute the ZapHyperlinks macro, all hyperlinks on the active sheet are
deleted and replaced with normal text.
When you add a new sheet to a workbook, it contains the default page setup setting.
Here's an easy way to transfer the settings from one worksheet to additional
worksheets:
1. Activate the sheet that contains the desired setup info. This is the "source"
sheet.
2. Select the "target" sheets. Press Ctrl and click the sheet tabs of the sheets you
want to update with the settings from the source sheet.
3. Select File, Page Setup and click OK.
If the files you import are always parsed correctly, you may prefer to bypass this wizard
and accept the defaults. To do so:
Note: When you import a file with a .csv extension, the Text Import Wizard won't kick
in. To override this default, you need to change the file's extension from .csv to .txt.
But if your workbook contains many sheets, and not all of the sheets' tabs fit on the
screen, you may find it tedious to scroll through the tabs or use the keyboard to
activate a distant sheet.
Here's a little-known trick that will allow you to bypass repeated scrolling or typing:
Display a pop-up list of sheet names by right-clicking one of the arrows to the left of the
sheet tabs that are located at the bottom of the worksheet window (see the figure
below). Select a sheet from the list, and you're there in a flash.
The first list is in A2:B19, and this range is named OldList. The second list is in D2:E19,
and the range is named NewList. The ranges were named using the Insert - Name -
Define command. Naming the ranges is not necessary, but it makes them easier to
work with.
As you can see, items in OldList that do not appear in NewList are highlighted with a
yellow background. Items in NewList that do not appear in OldList are highlighted with a
green background. These colors are the result of Conditional Formatting.
How to do it
1. Start by selecting the OldList range.
2. Choose Format - Conditional Formatting
3. In the Conditional Formatting dialog box, use the drop-down list to choose
Formula is.
4. Enter this formula:
=COUNTIF(NewList,A2)=0
5. Click the Format button and specify the formatting to apply when the condition
is true (a yellow background in this example).
6. Click OK
=COUNTIF(OldList,D2)=0
5. Click the Format button and specify the formatting to apply when the condition
is true (a green background in this example).
6. Click OK
Both of these conditional formatting formulas use the COUNTIF function. This function
counts the number of times a particular value appears in a range. If the formula returns
0, it means that the item does not appear in the range. Therefore, the conditional
formatting kicks in and the cell's background color is changed.
The cell reference in the COUNTIF function should always be the upper left cell of the
selected range.
If the formulas contain only absolute cell references, it's a piece of cake. Just use the
standard copy/paste commands. But if the formulas contain relative or mixed
references, the standard copy/paste technique won't work because the relative and
mixed references will be adjusted when the range is pasted.
If you're a VBA programmer, you can simply execute the following code:
With Sheets("Sheet1")
.Range("A11:D20").Formula = .Range("A1:D10").Formula
End With
Here's a procedure to accomplish this task without using VBA. (contributed by Bob Umlas):
Yes. You've already unlocked your input cells and ensured that all other cells are locked.
By default all cells are locked, but you can change that by using the Protection tab of
the Format Cells dialog box. Select the cells to be changed and choose Format, Cells. In
this case, the input cells are unlocked and all other cells are locked.
This does not prevent the user from selecting unlocked cells using the cursor keys. To
make those cells unselectable, change the worksheet's EnableSelection property. Select
View, Toolbars, Control Toolbox to display the Control Toolbox toolbar. Click the
Properties button to display the Properties box for the worksheet, then click the cell
labeled "xlNoRestrictions" and use the drop-down list to change the EnableSelection
property to xlUnlockedCells. Close the Properties box. As long as the worksheet is
protected, users cannot select the locked cells on the worksheet.
This procedure does not save the EnableSelection property setting with the workbook.
To create a simple macro that turns this setting on when the workbook is opened, press
Alt-F11 to activate the Visual Basic Editor. Locate your workbook name in the Project
window, and double-click it to expand its listing. Then double-click the item labeled
ThisWorkbook and enter the following VBA code:
Private Sub Workbook_Open()
Worksheets("Sheet1").EnableSelection = xlUnlockedCells
End Sub
This macro executes whenever the workbook is opened, and sets the EnableSelection
property of Sheet1 to xlUnlockedCells. The technique can be circumvented by changing
the EnableSelection property to its default value (xlNoRestrictions). Few users know
about this dodge, however.
Cell protection
Every cell has two key properties: locked and hidden. A locked cell can't be changed,
and the contents of a hidden cell don't appear in the formula bar when the cell is
selected. By default, every cell is locked and not hidden. Locked and hidden attributes
have no effect unless the worksheet is protected.
To change these attributes, select the appropriate cell or a range and then choose
Format, Cells. In the Format Cells dialog box, click the Protection tab and select Locked
or Hidden. Unlock cells that accept user input, and lock formula cells and other cells that
should stay unchanged (such as titles). To prevent others from seeing your formulas,
lock and hide the formula cells--the results of the formulas will be visible, but the
formulas will not.
To protect a sheet, choose Tools, Protection, Protect Sheet to bring up the Protect Sheet
dialog, and make sure Contents is checked. You can enter a password to prevent others
from unprotecting the sheet. Locked cells in a protected sheet cannot be edited, and
other worksheet changes are disabled. For example, no one can insert rows or columns,
change column width, or create embedded charts.
Note: Excel 2002 offers additional options regarding what the user can and cannot do
when a sheet is protected. For example, you can protect a sheet and still allow sorting
and autofiltering.
• In Excel 97, select File, Save As to display the Save As dialog box; then click
Options in that box to call up the Save Options dialog.
• In Excel 2000 and Excel 2002, select Tools, General Options when the Save As
dialog box appears. If you enter a password in the "Password to open" field, the
user must provide the correct password to open the file. If you enter a password
in the "Password to modify" field, the user must give the right password to make
changes to the file. Without the correct password, the file opens in read-only
mode.
Note: Excel 2002 also lets you specify the type of encryption, if any, that will be used.
Access this feature by clicking the Advanced button in the Save Options dialog box.
A better approach is to change the default. Select Tools, Options and click General in
the Options dialog box. Then change the setting for "Sheets in new workbook". Now all
new workbooks will have the number of sheets you specified.
AutoCorrect, which debuted in Excel 95, can correct common spelling errors on the fly.
As many users of Excel have discovered, you can also assign "shorthand shortcuts" that
expand to a longer sequence of characters. For example, you may define "awc" as an
AutoCorrect shortcut for "Amalgamated Widget Corporation of America." When you type
awc into a cell, Excel will then replace it with the associated text string. You define and
manage your shortcuts by using the Tools, AutoCorrect command.
Excel and all other Microsoft Office applications store AutoCorrect shortcuts in a single
*.acl file in your Windows folder (the exact file name will vary). So changes you make
from Excel, say, will be available in Word. However, there's no tool for manually editing
the binary *.acl file and moving such a file from one system to another will invalidate
your existing entries. The solution is to use a VBA macro to create the shortcuts.
Start Excel with a new workbook with one sheet, and then enter your shortcuts and
their associated text into columns A and B, respectively (as in the figure below). Enter
as many as you like, beginning in row 1, and don't include any blank rows between the
entries. Save and name this worksheet.
Select Tools, Macro, Macros to display the Macros dialog box. Type CreateShortcuts in
the Macro Name field and click Create. Then enter the following macro into the VBA
module, and press Alt-F11 to return to Excel.
Sub CreateShortcuts()
ItemCount = Application.CountA(Range("Sheet1!A:A"))
For Row = 1 To ItemCount
You've encountered the infamous "phantom link" phenomenon. I've never known Excel
to be wrong about identifying links, so there's an excellent chance that your workbook
does contain one or more links -- but they are probably not formula links.
1. Select Edit, Links. In many cases, this command may not be available. If it is
available, the Links dialog box will tell you the name of the source file for the
link. Click the Change Source button and change the link so it refers to the
active file.
2. Select Insert, Name, Define. Scroll through the list of names in the Define Name
dialog box and examine the Refers to box (see the figure below). If a name
refers to another workbook or contains an erroneous reference such as #REF!,
delete the name. This is, by far, the most common cause of phantom links
3. If you have a chart in your workbook, click on each data series in the chart and
examine the SERIES formula displayed in the formula bar. If the SERIES formula
refers to another workbook, you've identified your link. To eliminate the link
move or copy the chart's data into the current workbook and recreate your
chart.
4. If your workbook contains any custom dialog sheets, select each object in each
dialog sheet and examine the formula bar. If any object contains a reference to
another workbook, edit or delete the reference.
Next, save your workbook and then re-open it. It should open up without asking you to
update the links.
One problem with AutoFiltering is that you can't tell which criteria are in effect. Stephen
Bullen developed a custom VBA worksheet function that displays the current AutoFilter
criteria in a cell. The instructions that follow are for Excel 97 or later.
Press Alt+F11 and insert a new module for the active workbook. Then enter the VBA
code for the FilterCriteria shown below.
Function FilterCriteria(Rng As Range) As String
'By Stephen Bullen
Dim Filter As String
Filter = ""
On Error GoTo Finish
With Rng.Parent.AutoFilter
If Intersect(Rng, .Range) Is Nothing Then GoTo Finish
With .Filters(Rng.Column - .Range.Column + 1)
If Not .On Then GoTo Finish
Filter = .Criteria1
Select Case .Operator
Case xlAnd
Filter = Filter & " AND " & .Criteria2
Case xlOr
Filter = Filter & " OR " & .Criteria2
End Select
End With
End With
Finish:
FilterCriteria = Filter
End Function
After you've entered the VBA code, you can use the function in your formulas. The
single-cell argument for the FilterCriteria function can refer to any cell within the column
The figure below shows the FilterCriteria in action. The function is used in the cells in
row 1. For example, cell A1 contains this formula:
=FilterCriteria(A3)
As you can see, the list is currently filtered to show rows in which column A contains
January, column C contains a code of A or B, and column D contains a value greater
than 125 (column B is not filtered, so the formula in cell B1 displays nothing). The rows
that don't match these criteria are hidden.
To view the actual document, Click here. The interactive document will appear in a
new browser window.
You can change the year in cell C3 and the sheet will update automatically. The sheet
isn't protected,o you can even examine the formulas. Because there's no formula bar,
you will have to press F2 to view the formula in the active cell.
To view an interactive Excel file, you need Internet Explorer 4.01 or later, and Microsoft
Office Web Components (included with most versions of Office 2000 and later) must be
installed on your system.
Note: If you have Excel 2000 installed on your system and you receive an error
message when attempting to view an interactive spreadsheet on the Web, check your
version of the software. For reasons known only to Microsoft, the Office Web
components aren't included with the Small Business Edition of Office 2000 or with the
stand-alone version of Excel 2000. In other words, your copy of Excel 2000 may be
lacking one of the key selling points of the product. According to Microsoft, you can
legally install the Office Web Components if you own Office 2000 Small Business Edition
and if someone in your organization has a license for Microsoft Office 2000 Premium,
Professional, or Standard, or Microsoft Access 2000. If you have only the stand-alone
version of Excel, you cannot install the Web Components.