I found this procedure (credit to Orrin White), that I thought was interesting to give a try, but I'm having an issue getting it to run in O365 with a sub or function not defined error.
It stops on this line: r = Root(r, )
It's way over my head, so I'm wondering if someone can help?
Thanks in advance,
Don
It stops on this line: r = Root(r, )
It's way over my head, so I'm wondering if someone can help?
VBA Code:
Sub Stars()
Dim Imaginary As Boolean, n, h, c As Integer
Dim Pi, i, j, k, l, r, s, t, p, x, y As Single, SCin, SCout As Long
Dim u, v, w, z As Single, OO As Range
Dim Replace As Boolean: Replace = True
SCin = ActiveSheet.Shapes.Count: t = 0: c = 8
Set OO = ActiveCell
u = OO.Height
v = OO.Width
w = OO.Top
z = OO.Left
s = Application.InchesToPoints(0.006): Pi = GetPi
n = 6: r = Sqr(2) ^ n: Imaginary = True
If r < 0 Then t = Pi
If Imaginary Then
If r < 0 Then t = 3 * Pi / 2
If r > 0 Then t = Pi / 2
End If
r = Abs(r)
r = Root(r, (n))
p = t
DrawStar: i = r * Cos(t) * v + z: j = -r * Sin(t) * u + w
For h = 2 To n + 1
t = p + h * (2 * Pi / n)
i = r * Cos(t) * v + z
j = -r * Sin(t) * u + w
If lsEven((n)) Then
t = t + (n - 2) / n * Pi
Else:
t = t + (n - 1) / n * Pi
End If
k = r * Cos(t) * v + z
i = -r * Sin(t) * u + w
ActiveSheet.Shapes.AddLine(k, i, i, j).Select
Selection.Name = "L" & h - 1
Next h
SCout = ActiveSheet.Shapes.Count
For h = SCout To SCin + 1 Step -1
ActiveSheet.Shapes(h).Select Replace: Replace = False
Next h
Selection.Group: c = n
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Select
Selection.ShapeRange.Line.ForeColor.SchemeColor = c
OO.Select
End Sub
Function lsEven(n As Integer) As Boolean
If n Mod 2 = 0 Then lsEven = True
End Function
Thanks in advance,
Don