编译错误期望的函数或变量 [英] Compile Error Expected Function Or Variable
本文介绍了编译错误期望的函数或变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新手,正在尝试学习VBA.当我输入代码时,出现编译错误期望的函数或变量.
I'm new and trying to learn VBA. When I'm typing in the code I get Compile Error Expected Function Or Variable.
与活动单元有关,但无法弄清楚.
Is something regarding the activecell, but can't figure it out.
Sub Testare()
Dim FilmName As String
Dim FilmLenght As Integer
Dim FilmDescription As String
Range("b10").Select
FilmName = ActiveCell.Value
FilmLenght = ActiveCell.Offset(0, 2).Value
If FilmLenght < 100 Then
FilmDescription = "Interesant"
Else
FilmDescription = "Suficient"
End If
MsgBox FilmName & " is " & FilmDescription
End Sub
推荐答案
当将Sub称为变量时,也会发生此错误(即在一个Sub中,迭代器为"a"的for循环,而另一个Sub被称为"a").
This error happens also when a Sub is called the same as variable (i.e. in one Sub you have for loop with iterator "a", whilst another Sub is called "a").
这给出了适合您描述的错误.
This gives an error that fits to your description.
致谢
这篇关于编译错误期望的函数或变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文