我如何在单元格的一边涂上厚边框

我想知道如何申请一个厚厚的右边框在Excel上的所有选定的单元格,最好使用快捷方式。 我尝试录制一个macros,然后应用一个厚边框,并删除顶部,底部和左侧的单元格,但这只意味着只有顶部单元格有正确的边框,其余的select有左和右边框。

我只是发现了macros的macros,所以如果有一个代码需要input的话,如果你不介意在input代码之前和之后告诉我该怎么做才能工作,那就太棒了。

像这样的东西应该工作…

Dim MyRange as range MyRange = activesheet.range("C1:C14") MyRange.Borders(xlEdgeRight).LineStyle = xlContinuous MyRange.Borders(xlEdgeRight).Weight = xlThick MyRange.Borders(xlInsideVertical).LineStyle = xlContinuous MyRange.Borders(xlInsideVertical).Weight = xlThick 

select可以用来代替MyRange Range对象

 Selection.Borders(xlEdgeRight).LineStyle = xlContinuous Selection.Borders(xlEdgeRight).Weight = xlThick Selection.Borders(xlInsideVertical).LineStyle = xlContinuous Selection.Borders(xlInsideVertical).Weight = xlThick 

其他线重量常数…

  'other weight constants... 'xlHairline 'xlMedium 'xlThick 'xlThin 

这应该工作:

 Sub ThickLeftBorders() 'Clear existing borders Selection.Borders.LineStyle = xlNone 'Apply left border With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThick End With 'Apply inside border (Left on all other columns in range) With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThick End With End Sub