-
Newbie Question
Guys I was reading VBA for dummies book and trying to run this, but everytime I run I get a syntax error message. Why??? Pls help! Thanks in advance
Code:
Sub MySub()
Static Counter As Integer
Dim Msg As String
Counter = Counter + 1
Msg = “Number of executions: “ & Counter
MsgBox Msg
End Sub
-
Something is wrong with your parenthesis in this line:
Code:
Msg = "Number of executions: " & Counter
Try this:
Code:
Sub MySub()
Static Counter As Integer
Dim Msg As String
Counter = Counter + 1
Msg = "Number of executions: " & Counter
MsgBox Msg
End Sub
-
Thanks chief!
I think it gives me error as I copy and paste it from pdf file. It runs well now.:yes
-
You can mark your thread solved using the thread tools at the top of the page. That way others won't waste time looking at threads that have been resolved.....