我在程序中选择了excel的一块区域(大于一个单元格)用来赋以数组值,我用什么办法可以将这个区域中所有单元格的属性设置为和这块区域一样?主要是想设置边框,如果不用循环最好

解决方案 »

  1.   

    供你参考
    Range("B1").Select
        ActiveCell.FormulaR1C1 = "1"
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        ActiveWindow.SelectedSheets.PrintPreview