簡體   English   中英

帶有邊框的運行時錯誤'438'

[英]Run-Time Error '438' with Border Around

我有以下代碼,符合要求。 但是,當它運行時,它會添加細邊框,但是粗邊框會給我一個Run-time 438 error

 Border = ActiveSheet.Range("A" & ActiveSheet.Rows.Count).End(xlUp).Row
Range("A3:H" & Border).Select
    With Selection.Borders
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With

Range("A3:H" & Border).BorderAround_
    Weight = xlThick

我的目標是在所有單元周圍提供邊框,然后在邊緣周圍提供粗邊框。 任何幫助都會很棒。 謝謝!

問題在於BorderAround 方法的語法樣式與Border 對象之間的區別。 Weight參數是內部參數名稱,而不是屬性(我希望我正確地描述了這一點!)。

Dim border As Long
border = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
With Range("A3:H" & border).Borders
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
End With
Range("A3:H" & border).BorderAround Weight:=xlThick

將權重分配給BorderAround時,請注意使用冒號BorderAround

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM