1
I've been using VBA quite a bit recently, and, so far, I haven't run into any issues. For some reason, and, I cannot for the life of me figure it out, visual basic wont include "+" or "-" signs in subroutines. The following is what I want the program to do:
Function f(x As Single) As Single
f = 0.2 + 25 * x - 200 * x ^ 2 + 675 * x ^ 3 - 900 * x ^ 4 + 400 * x ^ 5
End Function
Sub Simp()
Dim x As Single, y As Single
n = Cells(3, 3)
a = Cells(4, 3)
b = Cells(5, 3)
For i = 1 To n
a + i = Cells(2 + i, 1)
Next i
End Sub
The problem I've been having is that whenever I type in "a+i=Cells(2+i,1)" the program changes it to "a i=Cells(2+i,1)" and says "Compiling Error: Expected Sub, Function or Property." The same thing is not happening to other, completed, programs. What is this and how do I fix it?
3Have you tried swapping the equation? Put the Cells(...) on the left side of the equals sign. You cannot assign a value to "a + i" – TheUser1024 – 2014-04-21T11:55:30.933