Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么下面的代码是错误的?
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
调用该方法时出现“运行时错误 424:需要对象”错误。SetFontSize
SetFontSize
您没有调用函数,调用时不需要括号SetFontSize (a1)。
SetFontSize (a1)
只需使用:
SetFontSize a1