Sub SolutionEtGribouillage()
Dim i
RAZ
For i = 1 To 14
Application.Run CStr("Poly" & i)
Next
ollyWood
End Sub
Sub RAZ()
Dim s As Shape
For Each s In ActiveSheet.Shapes
If s.Type = 5 Then
s.Delete
End If
Next
End Sub
Sub ollyWood()
Dim s As Shape
Randomize 1600
ps = Array(-2, 17, 20, 11, 2, 21, 3, 7, 12, 9, 24, 13, 23, 6, 1, 15, 18, 19, 14, 8, 16, 22, 5, 10, 4)(Application.RandBetween(1, 24))
For Each s In ActiveSheet.Shapes
If s.Type = 5 Then
conscient s, ps
End If
Next
End Sub
Sub conscient(s As Shape, x)
s.ShapeStyle = 67
With s.Glow
.Color.ObjectThemeColor = 9: .Color.TintAndShade = 0: .Color.Brightness = 0
.Transparency = 0.6000000238: .Radius = 8
End With
s.SoftEdge.Type = 3: s.ThreeD.BevelTopType = 3: s.ThreeD.BevelTopInset = 6: s.ThreeD.BevelTopDepth = 6
With s.Fill
.Visible = -1: .PresetTextured x: .TextureTile = -1
.TextureOffsetX = 0: .TextureOffsetY = 0
.TextureHorizontalScale = 1: .TextureVerticalScale = 1: .TextureAlignment = 0
End With
End Sub
Wow! Quel chic! Te reste à faire la même chose pour les 455 autres solutions!Re
Puisqu'on parle folie et consorts
Alors une petite gaminerie
VB:Sub SolutionEtGribouillage() Dim i RAZ For i = 1 To 14 Application.Run CStr("Poly" & i) Next ollyWood End Sub Sub RAZ() Dim s As Shape For Each s In ActiveSheet.Shapes If s.Type = 5 Then s.Delete End If Next End Sub Sub ollyWood() Dim s As Shape Randomize 1600 ps = Array(-2, 17, 20, 11, 2, 21, 3, 7, 12, 9, 24, 13, 23, 6, 1, 15, 18, 19, 14, 8, 16, 22, 5, 10, 4)(Application.RandBetween(1, 24)) For Each s In ActiveSheet.Shapes If s.Type = 5 Then conscient s, ps End If Next End Sub Sub conscient(s As Shape, x) s.ShapeStyle = 67 With s.Glow .Color.ObjectThemeColor = 9: .Color.TintAndShade = 0: .Color.Brightness = 0 .Transparency = 0.6000000238: .Radius = 8 End With s.SoftEdge.Type = 3: s.ThreeD.BevelTopType = 3: s.ThreeD.BevelTopInset = 6: s.ThreeD.BevelTopDepth = 6 With s.Fill .Visible = -1: .PresetTextured x: .TextureTile = -1 .TextureOffsetX = 0: .TextureOffsetY = 0 .TextureHorizontalScale = 1: .TextureVerticalScale = 1: .TextureAlignment = 0 End With End Sub
Ave @Staple1600Bonsoir @garnote
Cool
J'ai appris un truc que j'ignorais sur Shapes.Addline
Et merci pour le lien
PS: Tu as vu mon MP?
Sub test_A()
Set shp = ActiveSheet.Shapes.AddLine(50, 100, 50, 200).Line
Dim sh_p As Shape
Set sh_p = ActiveSheet.Shapes.AddLine(75, 100, 75, 200)
End Sub
Sub test_B_Pas_OK()
Dim shp As Shape
Set shp = ActiveSheet.Shapes.AddLine(50, 50, 50, 50).Line
End Sub
Sub test_A()
ActiveSheet.DrawingObjects.Delete
Randomize 1600
DessinerCardioide 160, Application.RandBetween(0, 6)
End Sub
Sub test_B()
ActiveSheet.DrawingObjects.Delete
DessinerCardioide 500, 6
End Sub
Sub test_C()
ActiveSheet.DrawingObjects.Delete
DessinerCardioide 350, 51
End Sub
Private Sub DessinerCardioide(nbpts%, pas)
Dim r%, x0%, y0%, i%, j%, tablo As Variant, vPi As Double, TT As Double
Dim cercle As Shape, ligne As Shape
vPi = 4 * Atn(1): x0 = 250: y0 = 250: r = 200: npoints = nbpts: step = pas
'Ajout cercle
Set cercle = ActiveSheet.Shapes.AddShape(msoShapeOval, x0 - r, y0 - r, 2 * r, 2 * r)
cercle.Line.ForeColor.RGB = vbRed: cercle.Fill.ForeColor.RGB = vbBlack: cercle.Line.Weight = 0.1
ReDim tablo(1 To npoints, 1 To 2)
'Dessin points
For i = 1 To npoints
TT = (i - 1) * 2 * vPi / npoints
tablo(i, 1) = x0 + r * Cos(TT): tablo(i, 2) = y0 - r * Sin(TT)
Set pts = ActiveSheet.Shapes.AddShape(9, tablo(i, 1) - 2, tablo(i, 2) - 2, 4, 4)
pts.Line.ForeColor.RGB = vbBlue: pts.Fill.ForeColor.RGB = vbBlue
Next i
'Dessin Cardiode
j = npoints / 2 + 1
For i = 1 To npoints
Set ligne = ActiveSheet.Shapes.AddLine(tablo(i, 1), tablo(i, 2), tablo(j, 1), tablo(j, 2))
ligne.Line.ForeColor.RGB = vbRed: ligne.Line.Weight = 0.9
j = (j + step - 1) Mod npoints + 1
Next i
End Sub
'Crédits: garnote et Arnaldo Gunzi
Wow! De toute beauté et beaucoup de diversité. Je la copie pour tenter de la déchiffrer et la comprendre.Bonsoir @garnote
En attendant les matheux pur jus, pour ta spirale "infernale"
Voici en m'inspirant de ton classeur du message#204 et quelques lectures sur le net, un petit complément.
NB: lancez plus fois la macro Test_A pour voir les variantes.
VB:Sub test_A() ActiveSheet.DrawingObjects.Delete Randomize 1600 DessinerCardioide 160, Application.RandBetween(0, 6) End Sub Sub test_B() ActiveSheet.DrawingObjects.Delete DessinerCardioide 500, 6 End Sub Sub test_C() ActiveSheet.DrawingObjects.Delete DessinerCardioide 350, 51 End Sub Private Sub DessinerCardioide(nbpts%, pas) Dim r%, x0%, y0%, i%, j%, tablo As Variant, vPi As Double, TT As Double Dim cercle As Shape, ligne As Shape vPi = 4 * Atn(1): x0 = 250: y0 = 250: r = 200: npoints = nbpts: step = pas 'Ajout cercle Set cercle = ActiveSheet.Shapes.AddShape(msoShapeOval, x0 - r, y0 - r, 2 * r, 2 * r) cercle.Line.ForeColor.RGB = vbRed: cercle.Fill.ForeColor.RGB = vbBlack: cercle.Line.Weight = 0.1 ReDim tablo(1 To npoints, 1 To 2) 'Dessin points For i = 1 To npoints TT = (i - 1) * 2 * vPi / npoints tablo(i, 1) = x0 + r * Cos(TT): tablo(i, 2) = y0 - r * Sin(TT) Set pts = ActiveSheet.Shapes.AddShape(9, tablo(i, 1) - 2, tablo(i, 2) - 2, 4, 4) pts.Line.ForeColor.RGB = vbBlue: pts.Fill.ForeColor.RGB = vbBlue Next i 'Dessin Cardiode j = npoints / 2 + 1 For i = 1 To npoints Set ligne = ActiveSheet.Shapes.AddLine(tablo(i, 1), tablo(i, 2), tablo(j, 1), tablo(j, 2)) ligne.Line.ForeColor.RGB = vbRed: ligne.Line.Weight = 0.9 j = (j + step - 1) Mod npoints + 1 Next i End Sub 'Crédits: garnote et Arnaldo Gunzi