[英]Why am I getting “run-time error '424': object required” using VBA in Excel?
[英]Why am I getting Object Required error (VBA, Excel)
為什么以下代碼有誤?
Sub SetFont()
Dim a1 As Range
Set a1 = Range("a1")
SetFontSize (a1)
End Sub
Sub SetFontSize(target As Range)
target.Font.Size = 11
End Sub
調用SetFontSize
方法時出現“運行時錯誤424:對象需要”錯誤。
你沒有調用函數,調用SetFontSize (a1)
時不需要括號。
只需使用:
SetFontSize a1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.