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:
- On the Home tab, click Format in the Cells group . Then, click Format Cells..
- In the Format Cells dialog box, click the Fill tab.
The following macro sets the pattern in every other row of the current selection to xlGray16.
Sample Visual Basic Procedure
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
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:
- Click Microsoft Office Button, and then click Excel Options.
- Click Customize.
- Click to select the All Commands under the Choose commands from.
- Click AutoFormat, click Add, and then click OK.
Article ID: 213616 - Last Review: Jan 10, 2007 - Revision: 1