Excel 2003 - VBA 用于循环遍历行中的每个单元格以提供属性/格式
假设我想让 excel ss 的第一行像这样:
.Rows("1:1").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
我只希望每个单元格都有轮廓,而不是整个选择。我怎么说对于第 1 行中的每个单元格,执行上述想法
谢谢!
say I want to make the first row of the excel ss something like this:
.Rows("1:1").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
only I want each individual cells to have the outline, not the entire selection. how can i say for each cell in row 1, do the above idea
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
还设置了
xlInsideHorizontal
记录一个宏,结果是
Also set the
xlInsideHorizontal
Record a Macro, and the result was
这很简单:
但这可能需要很长时间,因此在开始之前将
Application.ScreenUpdating
设置为 false!That's easy:
But this may take a very long time, so set
Application.ScreenUpdating
to false before you start!