non-integer scrollbar

B

Brad

I have an x-y (scatter) graph with non-integer, all positive x values and a
scrollbar set with an upper and lower limit. As I scroll, a vertical cursor
is moved through the chart but only to integer values. I'd like the vertical
cursor bar to move to each of the actual non-integer x values in my data as
I move the scrollbar.

Can anyone point me to VBA code or a formula solution to alter the scrollbar
so that it can handle non-integers?

My thanks in advance for any suggestions.

Cheers! Brad
 
D

Del Cotter

I have an x-y (scatter) graph with non-integer, all positive x values and a
scrollbar set with an upper and lower limit. As I scroll, a vertical cursor
is moved through the chart but only to integer values. I'd like the vertical
cursor bar to move to each of the actual non-integer x values in my data as
I move the scrollbar.

Try using the integer values to feed a formula like INDEX(), to choose
the nth X value in the data. If the X values are not in order, try using
RANK() instead.
 
J

John Mansfield

Assuming your scrollbar is named "Scrollbar1", you could divide the scrollbar
value by an integer to return non-integer data. For example, the code below
divides the integer value returned by the scrollbar by 1000 and then places
that value into cell A1. If the scrollbar value were 15, the code would
return 0.015 in cell A1.

Private Sub ScrollBar1_Change()
Range("A1").Value = ScrollBar1.Value / 1000
ScrollBar1.Max = 100
ScrollBar1.Min = -100
End Sub

Private Sub ScrollBar1_Scroll()
Range("A1").Value = ScrollBar1.Value / 1000
ScrollBar1.Max = 100
ScrollBar1.Min = -100
End Sub

You could also do so by performing the division in another cell. If the
number returned in cell A1 were 15, in cell A2 you could divide it by 1000 to
get 0.015. You could then use that cell as your source value.
 
B

B. R.Ramachandran

Hi,

This might work.

Let's imagine that the x- and y- data are in columns A and B, and the
scrollbar is linked to C2. Set the lower and upper limits of the scrollbar
to the lowest and highest row numbers of your data-range. In another cell,
say C3, enter the formula =INDIRECT("A"&C2). Link the cursor-bar to C3.

Now as you move the scrollbar, C2 and C3 will step through the row numbers
and the corresponding x-values respectively. Since the cursor is linked to
C3, it will step through the data-points on the graph.

With regards,
B. R. Ramachandran
 

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