0
我有一个电子表格,包含分散的单元格,我想在粗边框中进行轮廓。我已经把单元格放在一个数组中。有些是个别的细胞,有些是连续的分组。由于添加这些边框的代码很长,我想循环遍历将具有边框的单元格。如何通过使用数组分散选择单元格来循环
我试图选择单元格的行正在使用我编写的语法,它显然不起作用。有没有可行的语法,还是我以错误的方式处理问题?
arrCellBorders = Array("A2", "A3", "A6", "B5", "G1", "E7:E10", "E19:E22", "E33:E36", "I7:I10", "I19:I22", "I33:I36", "K7:K10", "K19:K21", "K33", "O7:O10", "O19:O21", "O33", "Q7", "Q9:Q10", "U7", "U9:U10")
For iCounter = 0 To 20
Range("arrCellBorders(iCounter)").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
Next iCounter