本文主要是介绍VBA小代码 ==> 一句代码加全部框线,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
我要加全部框线,录制宏得到的代码(心态爆炸,加个框线需要这么多代码么?):
Sub 宏1()
'
' 宏1 宏
'Range("C7:D9").SelectSelection.Borders(xlDiagonalDown).LineStyle = xlNoneSelection.Borders(xlDiagonalUp).LineStyle = xlNoneWith Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous.ColorIndex = 0.TintAndShade = 0.Weight = xlThinEnd WithWith Selection.Borders(xlEdgeTop).LineStyle = xlContinuous.ColorIndex = 0.TintAndShade = 0.Weight = xlThinEnd WithWith Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous.ColorIndex = 0.TintAndShade = 0.Weight = xlThinEnd WithWith Selection.Borders(xlEdgeRight).LineStyle = xlContinuous.ColorIndex = 0.TintAndShade = 0.Weight = xlThinEnd WithWith Selection.Borders(xlInsideVertical).LineStyle = xlContinuous.ColorIndex = 0.TintAndShade = 0.Weight = xlThinEnd WithWith Selection.Borders(xlInsideHorizontal).LineStyle = xlContinuous.ColorIndex = 0.TintAndShade = 0.Weight = xlThinEnd With
End Sub
实际只需要:
Selection.Borders.LineStyle = xlContinuous
这篇关于VBA小代码 ==> 一句代码加全部框线的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!