Assigning macro to SCROLL BAR/SPIN BUTTON

AjinkyaG

New Member
Joined
Jun 20, 2019
Messages
15
HI,
I have X,Y,Z coordinates of points(10 points) on a line. This line changes according to Time.. for each time change line changes and points on it also changes. Suppose it changes 5 times So I will have 5 such XYZ values for those 10 points. I have data for each time pasted in different columns A,B,C,D.....in manner X,Y,Z,X,Y,Z and so on.. means X will be in Column A, Y will be in Column B, Z will be in Column C, Again for different time X will be in D, Y will be in E and so on, to plot those points I am using

Sub Chartone()
Dim cht As ChartObject




Range("A:A,B:B").Select


ActiveSheet.Shapes.AddChart2(269, xlBubble3DEffect).Select
ActiveChart.SetSourceData Source:=Range("Sheet2!$A:$A,Sheet2!$B:$B")

ActiveChart.Parent.Name = "TOPTime1"
Set cht = ActiveSheet.ChartObjects("TOPTime1")
cht.Chart.HasTitle = True
cht.Chart.ChartTitle.Text = "TOP-Time1"


With cht
.Top = Range("A100").Top
''.Width = Range("A1:G12").Width
''.Height = Range("A1:G12").Height
.Left = Range("A100").Left
End With
With ActiveSheet.ChartObjects("TOPTime1").Chart
.Axes(xlValue).MinimumScale = 5000
.Axes(xlValue).MaximumScale = 7000
.Axes(xlCategory).MinimumScale = 0
.Axes(xlCategory).MaximumScale = 1400
End With


Range("A:A,C:C").Select
ActiveSheet.Shapes.AddChart2(269, xlBubble3DEffect).Select
ActiveChart.SetSourceData Source:=Range("Sheet2!$A:$A,Sheet2!$C:$C")
ActiveChart.Parent.Name = "FrontTime1"

Set cht = ActiveSheet.ChartObjects("FrontTime1")
cht.Chart.HasTitle = True
cht.Chart.ChartTitle.Text = "Front-Time1"
With cht
.Top = Range("A114").Top
''.Width = Range("A1:G12").Width
''.Height = Range("A1:G12").Height
.Left = Range("A114").Left
End With
With ActiveSheet.ChartObjects("FrontTime1").Chart
.Axes(xlValue).MinimumScale = 0
.Axes(xlValue).MaximumScale = 1400
.Axes(xlCategory).MinimumScale = 0
.Axes(xlCategory).MaximumScale = 1400
End With




Range("B:B,C:C").Select
ActiveSheet.Shapes.AddChart2(269, xlBubble3DEffect).Select
ActiveChart.SetSourceData Source:=Range("Sheet2!$B:$B,Sheet2!$C:$C")
ActiveChart.Parent.Name = "SideTime1"
Set cht = ActiveSheet.ChartObjects("SideTime1")
cht.Chart.HasTitle = True
cht.Chart.ChartTitle.Text = "Side-Time1"
With cht
.Top = Range("I114").Top
''.Width = Range("A1:G12").Width
''.Height = Range("A1:G12").Height
.Left = Range("I114").Left
End With
With ActiveSheet.ChartObjects("SideTime1").Chart
.Axes(xlValue).MinimumScale = 0
.Axes(xlValue).MaximumScale = 1400
.Axes(xlCategory).MinimumScale = 5000
.Axes(xlCategory).MaximumScale = 7000
End With
End Sub


Here I am plotting XY,XZ,YZ using A,B,C columns..Again for next step XY,XZ,YZ using D,E,F columns..

I am interested to use Scroll bar or Spin button so that within same plot charts I can plot values for other time steps...Means I will have three charts__XY,XZ, and YZ..and in this charts by scrolling bar or button I will change Steps..So instead of plotting 15 charts in 3 charts(XY,XZ,YZ) it will be done by changing the scroll button or spinning it..
(plot axes ranges will be same)
Please help me in doing this thing??
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Watch MrExcel Video

Forum statistics

Threads
1,102,291
Messages
5,485,968
Members
407,523
Latest member
Talicius

This Week's Hot Topics

Top