vpJohan
vpJohan

Reputation: 85

Visual basic or me failing on simple code

Is there anything wrong here?

I get a syntax error message on even the simplest codes i try to write.

Ive tried copying various codes found on the internet but it all fails.

Could there be some basic vb setting that is missing?

I commonly get errors like:

Compile error: User-defined type not defined Whenever i try to load simle code pieces from forums.

Am I missing a library?

Sub Macro4()
'
' Macro4 Macro
'
Dim quantity As Integer = 10
End Sub

Upvotes: 0

Views: 52

Answers (1)

Goos van den Bekerom
Goos van den Bekerom

Reputation: 1493

Sub Macro4()
'
' Macro4 Macro
'
Dim quantity As Integer 
quantity = 10
End Sub

Do it like this. you can't declare and set a variable on the same line in VBA

Upvotes: 2

Related Questions