Trouble Setting Up Graph With Scroll Bar

D

Dave Marden

I am trying to set up an excel graph that will let me scroll through a large
amount of values. I want to be able to set my range as something like
A1:H501 and actually have data all the way to Row 65000.

What I want to do is then have a scroll bar be manually moved and the chart
update according to the new area I want charted. The Code Below is what I
have tried and I keep getting errors. Any help would be appreciated.

I am grabbing data from an Programmable Logic Controller and the data is
spread over a 2 hour period, so I want to be able to scroll through the
data.

Dim LowerBound As Double
Dim UpperBound As Double
Dim CenterSelection As Double
Dim GraphRange(5000, 32) As Single

Public Sub SBarArea_Change()
GetValues
End Sub

Public Sub GetValues()
Dim OriginalArea As Range
CenterSelection = Range("A46").Value
LowerBound = CenterSelection - 250
UpperBound = CenterSelection + 250
MsgBox "Before Copying"
OriginalArea = Range("D" & LowerBound & ":" & "K" & UpperBound)
Range("M15:T515") = Range(OriginalArea)
MsgBox "After Copying"
LowerBound = 0
UpperBound = 0
End Sub

It Appears that excel doesn't like me making my data in OriginalArea
dynamic.

Any help would be appreciated,
Dave Marden
 
J

Jim Cone

Andy Pope has a Scrolling data chart about 1/2 way down the
page here... http://www.andypope.info/charts.htm
You can download it.
The scroll bar changes the named range that the chart uses.

Also, I have a demo workbook... Scroll Worksheet List that
scrolls data (no chart involved). You could keep a static chart
data reference and scroll the data into it.
If you are interested, email me and I will send it to you.
-remove XXX from my email address... (e-mail address removed)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Dave Marden"
wrote in message
I am trying to set up an excel graph that will let me scroll through a large
amount of values. I want to be able to set my range as something like
A1:H501 and actually have data all the way to Row 65000.

What I want to do is then have a scroll bar be manually moved and the chart
update according to the new area I want charted. The Code Below is what I
have tried and I keep getting errors. Any help would be appreciated.
I am grabbing data from an Programmable Logic Controller and the data is
spread over a 2 hour period, so I want to be able to scroll through the
data.

Dim LowerBound As Double
Dim UpperBound As Double
Dim CenterSelection As Double
Dim GraphRange(5000, 32) As Single

Public Sub SBarArea_Change()
GetValues
End Sub

Public Sub GetValues()
Dim OriginalArea As Range
CenterSelection = Range("A46").Value
LowerBound = CenterSelection - 250
UpperBound = CenterSelection + 250
MsgBox "Before Copying"
OriginalArea = Range("D" & LowerBound & ":" & "K" & UpperBound)
Range("M15:T515") = Range(OriginalArea)
MsgBox "After Copying"
LowerBound = 0
UpperBound = 0
End Sub

It Appears that excel doesn't like me making my data in OriginalArea
dynamic.
Any help would be appreciated,
Dave Marden
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top