Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Macro and chart help

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro and chart help

It helps to see the code you are working with.

"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Macro and chart help

this the code for the chat
Sub TotalText()
'
' TotalText Macro
'

'
Range("A1:M30").Select
ActiveWorkbook.Worksheets("Data").Sort.SortFields. Clear
ActiveWorkbook.Worksheets("Data").Sort.SortFields. Add
Key:=Range("C2:C30"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Data").Sort
.SetRange Range("A1:M30")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(10), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Range("C11,J11,C20,J20,C24,J24,C28,J28,C31,J31,C36 ,J36").Select
Range("J36").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range( _

"Data!$C$11,Data!$J$11,Data!$C$20,Data!$J$20,Data! $C$24,Data!$J$24,Data!$C$28,Data!$J$28,Data!$C$31, Data!$J$31,Data!$C$36,Data!$J$36" _
)
ActiveChart.ChartType = xlColumnClustered
ActiveChart.ChartStyle = 44
ActiveChart.ClearToMatchStyle
ActiveChart.Legend.Select
Selection.Delete
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartTitle.Text = "Network Text's"
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
End Sub

"JLGWhiz" wrote:

It helps to see the code you are working with.

"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro and chart help

The way your code is written, the chart is constantly tied to the source
range and any change in the source range will change the chart. Some people
want this feature so their charts are always up to the minute.

To separate the chart from the source range, you can copy the data from the
source range to a different sheet that is not used by the general public and
use that to create the chart.

This would be the data you want to copy to the separate sheet:

Range("C11,J11,C20,J20,C24,J24,C28,J28,C31,J31,C36 ,J36")

By copying the data and then creating the chart, your chart will remain
unchanged until you run your macro to create it again. Of course it would
be wiser to write a new macro that simply updates the original rather than
continue to create each time, since the create method would generate error
flags due to the existing chart.
But the point is, unless you separate the chart from its source data and
others are using the source file, then you will continue to have the
potential for unwanted changes to your chart.


"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Macro and chart help

is there anyway i can have the chat display for like 10 min then delete itself

"JLGWhiz" wrote:

The way your code is written, the chart is constantly tied to the source
range and any change in the source range will change the chart. Some people
want this feature so their charts are always up to the minute.

To separate the chart from the source range, you can copy the data from the
source range to a different sheet that is not used by the general public and
use that to create the chart.

This would be the data you want to copy to the separate sheet:

Range("C11,J11,C20,J20,C24,J24,C28,J28,C31,J31,C36 ,J36")

By copying the data and then creating the chart, your chart will remain
unchanged until you run your macro to create it again. Of course it would
be wiser to write a new macro that simply updates the original rather than
continue to create each time, since the create method would generate error
flags due to the existing chart.
But the point is, unless you separate the chart from its source data and
others are using the source file, then you will continue to have the
potential for unwanted changes to your chart.


"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro and chart help

Why not just print it and then delete it?

"millwalll" wrote:

is there anyway i can have the chat display for like 10 min then delete itself

"JLGWhiz" wrote:

The way your code is written, the chart is constantly tied to the source
range and any change in the source range will change the chart. Some people
want this feature so their charts are always up to the minute.

To separate the chart from the source range, you can copy the data from the
source range to a different sheet that is not used by the general public and
use that to create the chart.

This would be the data you want to copy to the separate sheet:

Range("C11,J11,C20,J20,C24,J24,C28,J28,C31,J31,C36 ,J36")

By copying the data and then creating the chart, your chart will remain
unchanged until you run your macro to create it again. Of course it would
be wiser to write a new macro that simply updates the original rather than
continue to create each time, since the create method would generate error
flags due to the existing chart.
But the point is, unless you separate the chart from its source data and
others are using the source file, then you will continue to have the
potential for unwanted changes to your chart.


"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro and chart help

I think you need to re-post in the Chart group to get more knowledgeable
information. I have limited experience with charts created and controlled
via VBA.
I usually create my charts manually and then just update them through code.
Someone in the Chart group can probably give you same good advice on this.

"millwalll" wrote:

is there anyway i can have the chat display for like 10 min then delete itself

"JLGWhiz" wrote:

The way your code is written, the chart is constantly tied to the source
range and any change in the source range will change the chart. Some people
want this feature so their charts are always up to the minute.

To separate the chart from the source range, you can copy the data from the
source range to a different sheet that is not used by the general public and
use that to create the chart.

This would be the data you want to copy to the separate sheet:

Range("C11,J11,C20,J20,C24,J24,C28,J28,C31,J31,C36 ,J36")

By copying the data and then creating the chart, your chart will remain
unchanged until you run your macro to create it again. Of course it would
be wiser to write a new macro that simply updates the original rather than
continue to create each time, since the create method would generate error
flags due to the existing chart.
But the point is, unless you separate the chart from its source data and
others are using the source file, then you will continue to have the
potential for unwanted changes to your chart.


"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Macro and chart help

thanks one more question I trying to produce a chat and I get error saying
series format too long what does this mean ?

"JLGWhiz" wrote:

Why not just print it and then delete it?

"millwalll" wrote:

is there anyway i can have the chat display for like 10 min then delete itself

"JLGWhiz" wrote:

The way your code is written, the chart is constantly tied to the source
range and any change in the source range will change the chart. Some people
want this feature so their charts are always up to the minute.

To separate the chart from the source range, you can copy the data from the
source range to a different sheet that is not used by the general public and
use that to create the chart.

This would be the data you want to copy to the separate sheet:

Range("C11,J11,C20,J20,C24,J24,C28,J28,C31,J31,C36 ,J36")

By copying the data and then creating the chart, your chart will remain
unchanged until you run your macro to create it again. Of course it would
be wiser to write a new macro that simply updates the original rather than
continue to create each time, since the create method would generate error
flags due to the existing chart.
But the point is, unless you separate the chart from its source data and
others are using the source file, then you will continue to have the
potential for unwanted changes to your chart.


"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When the user
try's another search the chart goes wrong. So I need to delte the chart if
the user does another search. That way there wont be a chart on screen that
is wrong any can i do this by using if statement or is there another way to
do this?

Thanks

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Macro and chart help

This was asked and answered in the charting group.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"millwalll" wrote in message
...
thanks one more question I trying to produce a chat and I get error saying
series format too long what does this mean ?

"JLGWhiz" wrote:

Why not just print it and then delete it?

"millwalll" wrote:

is there anyway i can have the chat display for like 10 min then delete
itself

"JLGWhiz" wrote:

The way your code is written, the chart is constantly tied to the
source
range and any change in the source range will change the chart. Some
people
want this feature so their charts are always up to the minute.

To separate the chart from the source range, you can copy the data
from the
source range to a different sheet that is not used by the general
public and
use that to create the chart.

This would be the data you want to copy to the separate sheet:

Range("C11,J11,C20,J20,C24,J24,C28,J28,C31,J31,C36 ,J36")

By copying the data and then creating the chart, your chart will
remain
unchanged until you run your macro to create it again. Of course it
would
be wiser to write a new macro that simply updates the original rather
than
continue to create each time, since the create method would generate
error
flags due to the existing chart.
But the point is, unless you separate the chart from its source data
and
others are using the source file, then you will continue to have the
potential for unwanted changes to your chart.


"millwalll" wrote:

Hi all ,
Need some help I have recorded a macro that produces a chart. When
the user
try's another search the chart goes wrong. So I need to delte the
chart if
the user does another search. That way there wont be a chart on
screen that
is wrong any can i do this by using if statement or is there
another way to
do this?

Thanks



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
Macro to change position of chart labels on line chart Shane Henderson[_2_] Charts and Charting in Excel 1 May 27th 11 09:31 AM
chart with macro premuratus Excel Programming 6 June 8th 06 02:09 PM
About chart with a macro alvin Kuiper Excel Programming 1 February 11th 06 09:51 PM
Chart using Macro Abhijeet Charts and Charting in Excel 0 August 1st 05 05:00 PM
Chart Macro kwedde01[_2_] Excel Programming 1 June 14th 05 12:40 PM


All times are GMT +1. The time now is 10:41 AM.

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"