PDA

View Full Version : [SOLVED] Beginners question



Bob Parks
10-30-2004, 04:16 PM
Hello, I am "taking" a course that appeared on the Web but in the first lesson I've a problem.
The instruction reads were to copy:

Example 2.

Sub Example2()
For x = 1 To 5
Cells(x, 3).Select
Selection.Vaue = x + 1
Next x
End Sub

and then with the cursor somewhere within the macro press F5.

This generates a dialog box with Compile Error Variable Not Defined.

Was something left out of the instructions or have I gummed up my software?

I'm a rank beginner so all help will be appreciated.

Jacob Hilderbrand
10-30-2004, 04:54 PM
You probably have Option Explicit at the top of the macro. Also there is no need to select a range to change the value. Try this instead.


Sub Example2()
Dim x As Long
For x = 1 To 5
Cells(x, 3).Value = x + 1
Next x
End Sub

MUSASHI
10-30-2004, 04:56 PM
.vaue?

.value

Bob Parks
10-30-2004, 05:10 PM
Thank you.