急!vba中控制Excel单元格边框线

qinkai 2007-04-24 12:23:04
我用vba在Excel中根据变量划出相应范围内单元格的下面的边框线,代码如下:
With xlsheet.Range("B" & row & ":W" & row).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
但是运行结果是在相应的位置上下边框线却始终没有被画上,可是若将其中的变量指定为具体的行号后,运行结果却是正确的,如下
With xlsheet.Range("B25:W25").Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

不知这是为什么,有什么方法可以实现动态的给指定范围的单元格画下边框线,非常感谢各位高手的赐教,谢谢!!!
...全文
2489 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mynetpc 2007-04-29
  • 打赏
  • 举报
回复
那就用Cells(x,y).xxx
XYX_YE 2007-04-27
  • 打赏
  • 举报
回复
xlsheet.Range("B" & row & ":W" & row).Borders(xlEdgeBottom).LineStyle = xlContinuous

ok!
qinkai 2007-04-26
  • 打赏
  • 举报
回复
谢谢答复,我试了不行,对象没Value属性
XYX_YE 2007-04-25
  • 打赏
  • 举报
回复
xlsheet.Range("B" & row & ":W" & row).Borders(xlEdgeBottom).value=true试一试

5,173

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧