Reputation: 13
I've to assign an algebraic formula that contains a variable (i for example) to another variable (say a).
I'm probably not using the right syntax. I've searched but couldn't find relevant answers.
Dim i As Long, a As Long
For i = 1 To 30
a = SIN(RADIANS(i))
With ActiveSheet.Shapes("sketch_1").Duplicate
.IncrementTop i
.IncrementRotation a
End With
Next i
Is there also a way to directly enter the formula next to .IncrementRotation
as opposed to having seperate variable "a" to do this job?
Upvotes: 0
Views: 96
Reputation: 166825
You can use Excel formulas in VBA using WorksheetFunction
a = Sin(WorksheetFunction.Radians(i))
Upvotes: 2