我正在运行这个代码来修复我的工作簿中的格式,它似乎在某些情况下工作得很好,但在其他一些情况下,它停止了"1004错误“的消息在.Linestyle或.Weight.Anyone有任何建议,可能是哪里出了问题?非常感谢!
‘调整列的宽度&修复格式
Columns("A:D").AutoFit`
With Sheets("Sheet1")`
.Cells.Font.Size = 8`
End With`
Set rng1 = Columns("A:F")`
Set rng2 = Rows("1:10")`
With rng1.Borders`
.LineStyle = xlContinuous`
.Weight = xlHairline`
End With`
With rng2.Borders`
.LineStyle = xlNone`
End With`发布于 2017-05-29 21:27:43
在 With Sheets("Sheet1")... End With中设置范围。
With Sheets("Sheet1")
.Columns("A:D").AutoFit
.Cells.Font.Size = 8
Set rng1 = .Columns("A:F")
Set rng2 = .Rows("1:10")
End With
With rng1.Borders
.LineStyle = xlContinuous
.Weight = xlHairline
End With`
With rng2.Borders
.LineStyle = xlNone
End With当您退出与...时,已丢失父工作表关联...以.结束。
https://stackoverflow.com/questions/44243621
复制相似问题