Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
VH VH is offline
external usenet poster
 
Posts: 13
Default Update Chart by column

I want a chart to update so that I can se either next column or previous
column in the chart. I want the user to push a commandbutton (next column or
previous column) to see data from one column at the time. The first column is
the x- values and the rest is the y- values.

FYI: The X- values are the time axis. The rest of the columns are logdata.
The point is to see how the logdata varies.

X Y1 Y2 Y3 Y4 Y5

0,12 1,81 1,07 0,00 1,93 2,54
0,44 0,00 0,00 1,03 1,93 1,76
0,76 1,64 0,95 3,52 4,74 4,17
1,08 4,05 2,78 6,13 9,03 9,28
1,40 5,08 4,05 8,79 9,77 9,47
1,72 8,91 8,50 8,06 8,01 7,93
2,04 8,79 8,54 6,91 7,76 7,93
2,36 4,03 4,17 2,88 2,56 1,51
2,68 5,13 5,47 1,83 1,37 1,34
3,00 4,69 4,98 1,42 4,47 6,81
3,32 3,47 4,05 8,94 10,16 9,64
3,64 5,42 4,96 9,67 10,69 10,60
3,96 6,76 6,18 9,55 10,69 10,55
4,28 7,37 5,93 9,86 9,96 9,81

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Update Chart by column

Not sure if you want to only want one series at any one time on the chart,
or merely highlight the next of your series of the 5. This does the latter.

Sub Test()
Dim sr As Series
Dim scol As SeriesCollection
Static serHighlit As Long

On Error GoTo errH
Application.ScreenUpdating = False

If TypeOf ActiveSheet Is Worksheet Then
'' Worksheet chart
Set scol = ActiveSheet.ChartObjects(1).Chart.SeriesCollection
Else
'' chart-sheet
Set scol = ActiveSheet.SeriesCollection
End If

If serHighlit = scol.Count Then serHighlit = 0

serHighlit = serHighlit + 1

For Each sr In scol
sr.Border.Weight = 1
sr.Border.ColorIndex = xlNone 'xlAutomatic
Next

scol(serHighlit).Border.ColorIndex = xlAutomatic '3
scol(serHighlit).Border.Weight = 4

errH:
Application.ScreenUpdating = True
If Err.Number Then
MsgBox "error"
End If

End Sub


If you want all 5 series visible on the chart, change the pair of colorindex
values to the commented pair.

Regards,
Peter T


"VH" wrote in message
...
I want a chart to update so that I can se either next column or previous
column in the chart. I want the user to push a commandbutton (next column

or
previous column) to see data from one column at the time. The first column

is
the x- values and the rest is the y- values.

FYI: The X- values are the time axis. The rest of the columns are logdata.
The point is to see how the logdata varies.

X Y1 Y2 Y3 Y4

Y5

0,12 1,81 1,07 0,00 1,93 2,54
0,44 0,00 0,00 1,03 1,93 1,76
0,76 1,64 0,95 3,52 4,74 4,17
1,08 4,05 2,78 6,13 9,03 9,28
1,40 5,08 4,05 8,79 9,77 9,47
1,72 8,91 8,50 8,06 8,01 7,93
2,04 8,79 8,54 6,91 7,76 7,93
2,36 4,03 4,17 2,88 2,56 1,51
2,68 5,13 5,47 1,83 1,37 1,34
3,00 4,69 4,98 1,42 4,47 6,81
3,32 3,47 4,05 8,94 10,16 9,64
3,64 5,42 4,96 9,67 10,69 10,60
3,96 6,76 6,18 9,55 10,69 10,55
4,28 7,37 5,93 9,86 9,96 9,81



  #3   Report Post  
Posted to microsoft.public.excel.programming
VH VH is offline
external usenet poster
 
Posts: 13
Default Update Chart by column

Thanks Peter for your reply!

I tried your sollution, but unfortunatly it didn't do the job.

What I want is this:

Case:
The user pushes a commandbutton called "next".

Sollution:
The chart shows the next column of data.

The same thing with the "Previous" button, but of course this time the
previous column.

The number of columns in the worksheet varies. It can be from 10 to 250.

Column A is the X- values, Column B - are the logdata that I want the user
to view through.



Peter T skrev:

Not sure if you want to only want one series at any one time on the chart,
or merely highlight the next of your series of the 5. This does the latter.

Sub Test()
Dim sr As Series
Dim scol As SeriesCollection
Static serHighlit As Long

On Error GoTo errH
Application.ScreenUpdating = False

If TypeOf ActiveSheet Is Worksheet Then
'' Worksheet chart
Set scol = ActiveSheet.ChartObjects(1).Chart.SeriesCollection
Else
'' chart-sheet
Set scol = ActiveSheet.SeriesCollection
End If

If serHighlit = scol.Count Then serHighlit = 0

serHighlit = serHighlit + 1

For Each sr In scol
sr.Border.Weight = 1
sr.Border.ColorIndex = xlNone 'xlAutomatic
Next

scol(serHighlit).Border.ColorIndex = xlAutomatic '3
scol(serHighlit).Border.Weight = 4

errH:
Application.ScreenUpdating = True
If Err.Number Then
MsgBox "error"
End If

End Sub


If you want all 5 series visible on the chart, change the pair of colorindex
values to the commented pair.

Regards,
Peter T


"VH" wrote in message
...
I want a chart to update so that I can se either next column or previous
column in the chart. I want the user to push a commandbutton (next column

or
previous column) to see data from one column at the time. The first column

is
the x- values and the rest is the y- values.

FYI: The X- values are the time axis. The rest of the columns are logdata.
The point is to see how the logdata varies.

X Y1 Y2 Y3 Y4

Y5

0,12 1,81 1,07 0,00 1,93 2,54
0,44 0,00 0,00 1,03 1,93 1,76
0,76 1,64 0,95 3,52 4,74 4,17
1,08 4,05 2,78 6,13 9,03 9,28
1,40 5,08 4,05 8,79 9,77 9,47
1,72 8,91 8,50 8,06 8,01 7,93
2,04 8,79 8,54 6,91 7,76 7,93
2,36 4,03 4,17 2,88 2,56 1,51
2,68 5,13 5,47 1,83 1,37 1,34
3,00 4,69 4,98 1,42 4,47 6,81
3,32 3,47 4,05 8,94 10,16 9,64
3,64 5,42 4,96 9,67 10,69 10,60
3,96 6,76 6,18 9,55 10,69 10,55
4,28 7,37 5,93 9,86 9,96 9,81




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Update Chart by column

In what way didn't it work - it worked for me as far as "Next" is concerned.

To cater for next / previous ensure your previous button is named "Previous"
(case sensitive) and include the following in my previous example

dim x as long
If Application.Caller = "Previous" Then
x = -1
Else
x = 1
End If

'code

If x = -1 Then
If serHighlit <= 1 Then serHighlit = scol.Count
Else
If serHighlit = scol.Count Then serHighlit = 0
End If
serHighlit = serHighlit + x

'code

If you only want one series on the chart at any one time, forget about all
the re-formatting stuf and change the .Values property (ie Y-Values) of
seriescollection(1). This would be column of your range values say Offset
from the leftmost column by the static variable serHighlit

Regards,
Peter T

"VH" wrote in message
...
Thanks Peter for your reply!

I tried your sollution, but unfortunatly it didn't do the job.

What I want is this:

Case:
The user pushes a commandbutton called "next".

Sollution:
The chart shows the next column of data.

The same thing with the "Previous" button, but of course this time the
previous column.

The number of columns in the worksheet varies. It can be from 10 to 250.

Column A is the X- values, Column B - are the logdata that I want the

user
to view through.



Peter T skrev:

Not sure if you want to only want one series at any one time on the

chart,
or merely highlight the next of your series of the 5. This does the

latter.

Sub Test()
Dim sr As Series
Dim scol As SeriesCollection
Static serHighlit As Long

On Error GoTo errH
Application.ScreenUpdating = False

If TypeOf ActiveSheet Is Worksheet Then
'' Worksheet chart
Set scol = ActiveSheet.ChartObjects(1).Chart.SeriesCollection
Else
'' chart-sheet
Set scol = ActiveSheet.SeriesCollection
End If

If serHighlit = scol.Count Then serHighlit = 0

serHighlit = serHighlit + 1

For Each sr In scol
sr.Border.Weight = 1
sr.Border.ColorIndex = xlNone 'xlAutomatic
Next

scol(serHighlit).Border.ColorIndex = xlAutomatic '3
scol(serHighlit).Border.Weight = 4

errH:
Application.ScreenUpdating = True
If Err.Number Then
MsgBox "error"
End If

End Sub


If you want all 5 series visible on the chart, change the pair of

colorindex
values to the commented pair.

Regards,
Peter T


"VH" wrote in message
...
I want a chart to update so that I can se either next column or

previous
column in the chart. I want the user to push a commandbutton (next

column
or
previous column) to see data from one column at the time. The first

column
is
the x- values and the rest is the y- values.

FYI: The X- values are the time axis. The rest of the columns are

logdata.
The point is to see how the logdata varies.

X Y1 Y2 Y3 Y4

Y5

0,12 1,81 1,07 0,00 1,93 2,54
0,44 0,00 0,00 1,03 1,93 1,76
0,76 1,64 0,95 3,52 4,74 4,17
1,08 4,05 2,78 6,13 9,03 9,28
1,40 5,08 4,05 8,79 9,77 9,47
1,72 8,91 8,50 8,06 8,01 7,93
2,04 8,79 8,54 6,91 7,76 7,93
2,36 4,03 4,17 2,88 2,56 1,51
2,68 5,13 5,47 1,83 1,37 1,34
3,00 4,69 4,98 1,42 4,47 6,81
3,32 3,47 4,05 8,94 10,16 9,64
3,64 5,42 4,96 9,67 10,69 10,60
3,96 6,76 6,18 9,55 10,69 10,55
4,28 7,37 5,93 9,86 9,96 9,81






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Update Chart by column

change
If serHighlit <= 1 Then serHighlit = scol.Count


to
If serHighlit <= 1 Then serHighlit = scol.Count + 1

regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
In what way didn't it work - it worked for me as far as "Next" is

concerned.

To cater for next / previous ensure your previous button is named

"Previous"
(case sensitive) and include the following in my previous example

dim x as long
If Application.Caller = "Previous" Then
x = -1
Else
x = 1
End If

'code

If x = -1 Then
If serHighlit <= 1 Then serHighlit = scol.Count
Else
If serHighlit = scol.Count Then serHighlit = 0
End If
serHighlit = serHighlit + x

'code

If you only want one series on the chart at any one time, forget about all
the re-formatting stuf and change the .Values property (ie Y-Values) of
seriescollection(1). This would be column of your range values say Offset
from the leftmost column by the static variable serHighlit

Regards,
Peter T

"VH" wrote in message
...
Thanks Peter for your reply!

I tried your sollution, but unfortunatly it didn't do the job.

What I want is this:

Case:
The user pushes a commandbutton called "next".

Sollution:
The chart shows the next column of data.

The same thing with the "Previous" button, but of course this time the
previous column.

The number of columns in the worksheet varies. It can be from 10 to 250.

Column A is the X- values, Column B - are the logdata that I want the

user
to view through.



Peter T skrev:

Not sure if you want to only want one series at any one time on the

chart,
or merely highlight the next of your series of the 5. This does the

latter.

Sub Test()
Dim sr As Series
Dim scol As SeriesCollection
Static serHighlit As Long

On Error GoTo errH
Application.ScreenUpdating = False

If TypeOf ActiveSheet Is Worksheet Then
'' Worksheet chart
Set scol = ActiveSheet.ChartObjects(1).Chart.SeriesCollection
Else
'' chart-sheet
Set scol = ActiveSheet.SeriesCollection
End If

If serHighlit = scol.Count Then serHighlit = 0

serHighlit = serHighlit + 1

For Each sr In scol
sr.Border.Weight = 1
sr.Border.ColorIndex = xlNone 'xlAutomatic
Next

scol(serHighlit).Border.ColorIndex = xlAutomatic '3
scol(serHighlit).Border.Weight = 4

errH:
Application.ScreenUpdating = True
If Err.Number Then
MsgBox "error"
End If

End Sub


If you want all 5 series visible on the chart, change the pair of

colorindex
values to the commented pair.

Regards,
Peter T


"VH" wrote in message
...
I want a chart to update so that I can se either next column or

previous
column in the chart. I want the user to push a commandbutton (next

column
or
previous column) to see data from one column at the time. The first

column
is
the x- values and the rest is the y- values.

FYI: The X- values are the time axis. The rest of the columns are

logdata.
The point is to see how the logdata varies.

X Y1 Y2 Y3 Y4
Y5

0,12 1,81 1,07 0,00 1,93 2,54
0,44 0,00 0,00 1,03 1,93 1,76
0,76 1,64 0,95 3,52 4,74 4,17
1,08 4,05 2,78 6,13 9,03 9,28
1,40 5,08 4,05 8,79 9,77 9,47
1,72 8,91 8,50 8,06 8,01 7,93
2,04 8,79 8,54 6,91 7,76 7,93
2,36 4,03 4,17 2,88 2,56 1,51
2,68 5,13 5,47 1,83 1,37 1,34
3,00 4,69 4,98 1,42 4,47 6,81
3,32 3,47 4,05 8,94 10,16 9,64
3,64 5,42 4,96 9,67 10,69 10,60
3,96 6,76 6,18 9,55 10,69 10,55
4,28 7,37 5,93 9,86 9,96 9,81








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make one column update another column in Exell Canron newbie Excel Worksheet Functions 2 April 16th 08 04:38 PM
how do I update a column and create new rows for new column cells Pete Excel Discussion (Misc queries) 1 June 6th 07 02:02 AM
Column Chart Update automatically for all worksheets? TJAC Charts and Charting in Excel 1 May 5th 07 09:22 PM
chart from pivot data does not update x-axis bar chart values - bug jason gers Excel Discussion (Misc queries) 0 April 3rd 07 06:34 PM
Dynamic Chart Range and Chart Update ExcelMonkey[_154_] Excel Programming 1 July 6th 04 08:26 PM


All times are GMT +1. The time now is 02:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"