Excel宏 - 删除或添加对角线边框

时间:2016-12-20 18:36:51

标签: excel vba module macros excel-2007

我对编码很新,需要一个删除对角线边框的代码。

此宏用作按钮,用以下代码清空单元格:

Sub Southwood_Click()
Sheets("Southwood").Range("C6:C8") = ""
Sheets("Southwood").Range("D9:F9") = ""
Sheets("Southwood").Range("F6:J8") = ""
Sheets("Southwood").Range("J9") = ""
Sheets("Southwood").Range("M6:S9") = ""
Sheets("Southwood").Range("C26:C28") = ""
Sheets("Southwood").Range("E26:E28") = ""
Sheets("Southwood").Range("H26:O28") = ""
Sheets("Southwood").Range("M29") = ""
Sheets("Southwood").Range("C52:M54") = ""
Sheets("Southwood").Range("C75:H77") = ""
Sheets("Southwood").Range("J75:J77") = ""
Sheets("Southwood").Range("L75:P77") = ""
MsgBox "Southwood has been cleared."
End Sub

我还想删除此行的仅对角线边框:

Sheets("Southwood").Range("M6:S9") = ""

这是如何实现的?

1 个答案:

答案 0 :(得分:2)

删除所有边框:ODBC CONNECT TO XXX); abc: SQL DECLARE @www INT SET @www= ( SELECT max(Id) FROM [].[].[] where) SQL select * FROM [].[].[] JOIN [].[.[] on .[] = .[] where [qqq] = @www order by rrr desc;

仅删除对角线边框:

Sheets("Southwood").Range("M6:S9").Borders.LineStyle = xlNone