Sub SheetTriangle()
'auteur: D. Kusleika
Dim CurrX As Double, CurrY As Double
Dim Vertices(1 To 3, 1 To 2) As Double, NextVert&, wsh As Worksheet
Vertices(1, 1) = 128
Vertices(1, 2) = 1
Vertices(2, 1) = 1
Vertices(2, 2) = 227
Vertices(3, 1) = 256
Vertices(3, 2) = 227
Set wsh = ThisWorkbook.Worksheets.Add
wsh.Cells.RowHeight = 1.5: wsh.Cells.ColumnWidth = 0.17
'Start at the third vertex
NextVert = 3
CurrX = Vertices(NextVert, 1)
CurrY = Vertices(NextVert, 2)
'loop ten thousand times
For i = 1 To 50000
NextVert = Int(3 * Rnd + 1) 'pick a random vertext
GetNewPoint CurrX, CurrY, Vertices(NextVert, 1), _
Vertices(NextVert, 2) 'find the midway point
PlacePointWsh CLng(CurrX), CLng(CurrY), wsh 'color a cell at that point
Next i
End Sub