Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Const PI As Double = 3.141592
- Dim KolejneUruchomienie As Double
- Sub ZrobZegar_Walkowski()
- Wykres
- Tarcza
- Wskazowki
- End Sub
- Sub Wykres()
- ActiveSheet.Shapes.AddChart(xlXYScatterLines, 30, 30, 300, 300).Select
- ActiveChart.SetSourceData Source:=Workbooks(1).Worksheets(1).Range("$A$1:$F$6")
- ActiveSheet.ChartObjects(1).Chart.HasLegend = False
- ActiveSheet.ChartObjects(1).Chart.HasTitle = False
- ActiveSheet.ChartObjects(1).Chart.ChartArea.Interior.ColorIndex = 20
- ActiveSheet.ChartObjects(1).Chart.PlotArea.Interior.ColorIndex = 20
- End Sub
- Sub Tarcza()
- Dim X(1 To 12) As Double
- Dim Y(1 To 12) As Double
- Dim Rozmiar As Double
- Rozmiar = 1
- For i = 1 To 12
- X(i) = Rozmiar * Sin(i * (2 * PI / 12))
- Y(i) = Rozmiar * Cos(i * (2 * PI / 12))
- Next i
- ActiveChart.SeriesCollection(1).XValues = X
- ActiveChart.SeriesCollection(1).Values = Y
- For i = 1 To 12
- ActiveChart.SeriesCollection(1).Points(i).HasDataLabel = True
- ActiveChart.SeriesCollection(1).Points(i).DataLabel.Text = Str(i)
- Next i
- ActiveChart.Axes(xlValue).MajorGridlines.Delete
- ActiveChart.Axes(1).Delete
- ActiveChart.Axes(2).Delete
- ActiveChart.SeriesCollection(1).Border.ColorIndex = 20
- ActiveChart.SeriesCollection(1).MarkerStyle = xlMarkerStyleNone
- ActiveChart.SeriesCollection(2).MarkerStyle = xlMarkerStyleNone
- End Sub
- Sub Wskazowki()
- Dim X1(1 To 2) As Variant
- Dim Y1(1 To 2) As Variant
- X1(1) = 0
- Y1(1) = X1(1)
- X1(2) = 0.7 * Sin(Second(Time) * (2 * PI / 60))
- Y1(2) = 0.7 * Cos(Second(Time) * (2 * PI / 60))
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(3).XValues = X1
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(3).Values = Y1
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(3).MarkerStyle = xlMarkerStyleNone
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(3).Border.Weight = 3
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(3).Border.ColorIndex = 23
- Dim X2(1 To 2) As Variant
- Dim Y2(1 To 2) As Variant
- X2(1) = 0
- Y2(1) = X2(1)
- X2(2) = 0.5 * Sin((Minute(Time) + (Second(Time) / 60)) * (2 * PI / 60))
- Y2(2) = 0.5 * Cos((Minute(Time) + (Second(Time) / 60)) * (2 * PI / 60))
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(4).XValues = X2
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(4).Values = Y2
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(4).MarkerStyle = xlMarkerStyleNone
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(4).Border.Weight = 3
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(4).Border.ColorIndex = 53
- Dim X3(1 To 2) As Variant
- Dim Y3(1 To 2) As Variant
- X3(1) = 0
- Y3(1) = X3(1)
- X3(2) = 0.3 * Sin((Hour(Time) + (Minute(Time) / 60)) * (2 * PI / 12))
- Y3(2) = 0.3 * Cos((Hour(Time) + (Minute(Time) / 60)) * (2 * PI / 12))
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(5).XValues = X3
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(5).Values = Y3
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(5).MarkerStyle = xlMarkerStyleNone
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(5).Border.Weight = 3
- ActiveSheet.ChartObjects(1).Chart.SeriesCollection(5).Border.ColorIndex = 43
- KolejneUruchomienie = Now + TimeValue("00:00:01")
- Application.OnTime KolejneUruchomienie, "Wskazowki"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement