![](/img/trans.png)
[英]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.