[英]Why am I getting Object Required error (VBA, Excel)
Why is the following code wrong? 为什么以下代码有误?
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
I am getting "Run-time error 424: Object required" error when calling the SetFontSize
method. 调用SetFontSize
方法时出现“运行时错误424:对象需要”错误。
You're not calling a function, you don't need the parentheses when calling SetFontSize (a1)
. 你没有调用函数,调用SetFontSize (a1)
时不需要括号。
Just use: 只需使用:
SetFontSize a1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.