Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

How to assign value of a formula (that contains a variable) to another variable

$
0
0

I'm new to vba and I'm in a situation where I've to assign an algebraic formula that contains a variable (i for eg.) to another variable (say a). How do i do that? I'm probably not using the right syntax. I've searched this everywhere but couldn't find relevant answers. Please help. my code is

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 this right? Is there also a way to directly enter the formula next to .IncrementRotation as opposed to having seperate variable "a" to do this job?


Viewing all articles
Browse latest Browse all 88835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>