6 Replies - 687 Views - Last Post: 24 November 2014 - 09:56 PM Rate Topic: -----

#1 taylorjwbrown  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 61
  • Joined: 19-October 14

scroll bar for y-axis changing?

Posted 23 November 2014 - 06:52 PM

I need some help with my homework please. I've looked in my book for the past few hours and can't find anything! the question is:

Add an embedded chart to a worksheet along with the scroll bar control. Attach code to the Change() event procedure of the Scroll Bar control that changes the maximum value y-axis scale.

Can someone help me with this? I don't even have any code started to copy and paste and this is getting upsetting. I don't even know where to begin. Any and all help would be appreciated, I am completely lost on this.

Is This A Good Question/Topic? 0
  • +

Replies To: scroll bar for y-axis changing?

#2 andrewsw  Icon User is online

  • blow up my boots
  • member icon

Reputation: 6445
  • View blog
  • Posts: 26,067
  • Joined: 12-December 12

Re: scroll bar for y-axis changing?

Posted 23 November 2014 - 06:56 PM

You mention worksheet so I assume this is for Excel VBA?

Do you know how to add a Chart?
Do you know where the ScrollBar control can be found?
Do you know how to find its Change event?
Was This Post Helpful? 0
  • +
  • -

#3 taylorjwbrown  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 61
  • Joined: 19-October 14

Re: scroll bar for y-axis changing?

Posted 23 November 2014 - 06:59 PM

yes to all those. Would it be programming the scrollbar.min and .max value?
Was This Post Helpful? 0
  • +
  • -

#4 taylorjwbrown  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 61
  • Joined: 19-October 14

Re: scroll bar for y-axis changing?

Posted 23 November 2014 - 07:15 PM

This is what I have so far, still working on it:
Sub ScrollBar1_Change()
Dim myChart As Chart
Set myChart = ActiveSheet.ChartObjects(1).Chart

End Sub


Was This Post Helpful? 0
  • +
  • -

#5 taylorjwbrown  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 61
  • Joined: 19-October 14

Re: scroll bar for y-axis changing?

Posted 24 November 2014 - 06:03 PM

anyone?
Was This Post Helpful? 0
  • +
  • -

#6 taylorjwbrown  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 61
  • Joined: 19-October 14

Re: scroll bar for y-axis changing?

Posted 24 November 2014 - 06:09 PM

 
Sub ScrollBar1_Change()
ScrollBar1.Min = 0
ScrollBar1.Max = 5000
ScrollBar1.SmallChange = 5
ScrollBar1.LargeChange = 25
End Sub



where am i going wrong
Was This Post Helpful? 0
  • +
  • -

#7 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 328
  • View blog
  • Posts: 1,993
  • Joined: 26-March 09

Re: scroll bar for y-axis changing?

Posted 24 November 2014 - 09:56 PM

Define your scroll bar properties outside of the Change event.

In the change event, make the change to the y-axis of your chart.

Something like below

 
Sub ScrollBar1_Change()
  'I'm not clued up in VBA, so you need to figure out what the Chart property is you need to change!!!
  Chart.Yaxis = ScrollBar1.Value
End Sub



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1