Sub Macro1() ' ' Macro1 Macro ' Macro recorded 21.12.2005 by RM ' ' ActiveSheet.Shapes.AddShape(msoShapeOval, 72.75, 44.25, 32.25, 21.75).Select ActiveSheet.Shapes.AddShape(msoShapeOval, 78.75, 63.75, 32.25, 21#).Select ActiveSheet.Shapes.AddShape(msoShapeRectangle, 80.25, 29.25, 14.25, 16.5). _ Select ActiveSheet.Shapes.AddLine(82.5, 34.5, 87#, 39#).Select Selection.ShapeRange.Flip msoFlipHorizontal End Sub Sub ovaal1() Sheet1.Shapes.AddShape msoShapeOval, 100, 50, 40, 60 End Sub Sub ovaal2() kustuta laius = InputBox("palun laius") Sheet1.Shapes.AddShape msoShapeOval, 100, 50, laius, 60 End Sub Sub kustuta() For Each kujund In Sheet1.Shapes kujund.Delete Next kujund End Sub 'Joonista joonest ja ringist puu Sub puu1() kustuta Sheet1.Shapes.AddShape msoShapeOval, 100, 60, 50, 100 Sheet1.Shapes.AddLine 125, 160, 125, 260 End Sub Sub puu1a() Dim kujundid(1), abi kustuta Set abi = Sheet1.Shapes.AddShape(msoShapeOval, 100, 60, 50, 100) kujundid(0) = abi.Name Set abi = Sheet1.Shapes.AddLine(125, 160, 125, 260) kujundid(1) = abi.Name Sheet1.Shapes.Range(kujundid).Select Selection.ShapeRange.Group.Select End Sub 'Joonista kasutaja märgitud arv puid Sub puu2() kustuta kogus = InputBox("mitu puud?") vasak = 20 nihex = 60 For i = 1 To kogus Sheet1.Shapes.AddShape msoShapeOval, _ vasak + i * nihex, 60, 50, 100 Sheet1.Shapes.AddLine vasak + i * nihex + 25, 160, _ vasak + i * nihex + 25, 260 Next i End Sub 'Joonista puuderivi nõnda, et 'puude kõrgused on kirjas eraldi tulbas Sub kysimine() MsgBox Sheet1.Cells(2, 1) 'teine rida, esimene veerg End Sub Sub puud3() kustuta vasak = 80 alaserv = 280 laius = 50 nihex = 60 reanr = 2 While (Len(Cells(reanr, 1)) > 0) pikkus = Cells(reanr, 1) Sheet1.Shapes.AddShape msoShapeOval, vasak, alaserv - pikkus, _ laius, pikkus / 2 Sheet1.Shapes.AddLine vasak + laius / 2, alaserv - pikkus / 2, _ vasak + laius / 2, alaserv reanr = reanr + 1 vasak = vasak + nihex Wend End Sub Dim puukogum() Sub puud4() kustuta vasak = 80 alaserv = 280 laius = 50 nihex = 60 reanr = 2 While (Len(Cells(reanr, 1)) > 0) reanr = reanr + 1 Wend ReDim puukogum((reanr - 2) * 2) nimenr = 0 puukogum(nimenr) = Sheet1.Shapes.AddShape( _ msoShapeRectangle, vasak, _ alaserv - 300, (reanr - 2) * nihex, 300).Name nimenr = nimenr + 1 reanr = 2 While (Len(Cells(reanr, 1)) > 0) pikkus = Cells(reanr, 1) puukogum(nimenr) = Sheet1.Shapes.AddShape( _ msoShapeOval, vasak, alaserv - pikkus, _ laius, pikkus / 2).Name nimenr = nimenr + 1 puukogum(nimenr) = Sheet1.Shapes.AddLine( _ vasak + laius / 2, alaserv - pikkus / 2, _ vasak + laius / 2, alaserv).Name nimenr = nimenr + 1 reanr = reanr + 1 vasak = vasak + nihex Wend Sheet1.Shapes.Range(puukogum).Select Selection.ShapeRange.Group.Select End Sub 'Lisage puude grupi alla valge ristkülik Sub eurojoonis1() kustuta keskx = 200 kesky = 200 reanr = 2 suurim = 0 While (Len(Cells(reanr, 1)) > 0) If Sheet1.Cells(reanr, 1) > suurim Then suurim = Sheet1.Cells(reanr, 1) End If reanr = reanr + 1 Wend kogus = reanr - 2 maxtaht = 50 koef = maxtaht / suurim nurk = 0 nurgavahe = 6.28 / kogus r = 150 reanr = 2 For i = 1 To kogus d = Sheet1.Cells(reanr, 1) * koef Sheet1.Shapes.AddShape msoShape5pointStar, _ keskx + r * Cos(nurk) - d / 2, _ kesky + r * Sin(nurk) - d / 2, _ d, d nurk = nurk + nurgavahe reanr = reanr + 1 Next i End Sub Sub eurojoonis2() kustuta keskx = 200 kesky = 200 kogus = 12 nurk = 0 nurgavahe = 6.28 / kogus r = 150 For i = 1 To kogus Sheet1.Shapes.AddShape msoShape5pointStar, _ keskx + r * Cos(nurk), kesky + r * Sin(nurk), _ 50, 50 nurk = nurk + nurgavahe Next i End Sub