Excel Interop - Draw All Borders in a Range

后端 未结 7 1401
春和景丽
春和景丽 2020-12-17 18:29

I see from Microsoft\'s documentation that I can access the particular border edges of a cell using the \'xlBordersIndex\' property and for example set the border style for

7条回答
  •  遥遥无期
    2020-12-17 19:05

    For Each range In ranges
        For Each row As Range In .Range(range).Rows
            row.Cells.BorderAround(XlLineStyle.xlContinuous)
            row.Cells.Borders.Item(XlBordersIndex.xlInsideHorizontal).LineStyle = XlLineStyle.xlContinuous
            row.Cells.Borders.Item(XlBordersIndex.xlInsideVertical).LineStyle = XlLineStyle.xlContinuous
        Next
    Next
    

提交回复
热议问题