Export (0) Print
Expand All

Working with 3-D Ranges [Excel 2003 VBA Language Reference]

Office 2003

If you are working with the same range on more than one sheet, use the Array function to specify two or more sheets to select. The following example formats the border of a 3-D range of cells.

Sub FormatSheets()
    Sheets(Array("Sheet2", "Sheet3", "Sheet5")).Select
    Range("A1:H1").Select
    Selection.Borders(xlBottom).LineStyle = xlDouble
End Sub
		

The following example applies the FillAcrossSheets method to transfer the formats and any data from the range on Sheet2 to the corresponding ranges on all the worksheets in the active workbook.

Sub FillAll()
    Worksheets("Sheet2").Range("A1:H1") _
        .Borders(xlBottom).LineStyle = xlDouble
    Worksheets.FillAcrossSheets (Worksheets("Sheet2") _
        .Range("A1:H1"))
End Sub
		




Show:
© 2014 Microsoft