Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
uriel78
 
Posts: n/a
Default Create a new chart for every change of values in a combobox

I've got a bar chart that takes values from cells A1:B5

In C1 and in D1 I've got two combobox (created with data validation method),
each one allows me to choose 4 different parameters. By changing these
values, the values in A1:B5 and the chart changes too. Now, for every
change of data in C1 and/or D1 I copy & paste the chart to another sheet; in
this situation I've got only ONE chart
Is there a way to obtain a *new* chart every time I change parameter in C1
and D1, so that I can avoid to do the copy & paste the single chart manually
(that is too much time-expensive) and put the it into another sheet ?

Thanks in advance


  #2   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

You could use an event procedure to do this. Add the following code to
the sheet module, as described he

http://www.contextures.com/xlvba01.html#Worksheet

'=================================
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$C$1" Or _
Target.Address = "$D$1" Then
Charts.Add
With ActiveChart
.ChartType = xlColumnClustered
.SetSourceData Source:=Range("A1:B5")
.Location Whe=xlLocationAsNewSheet
End With
Me.Activate
End If

End Sub
'====================================

uriel78 wrote:
I've got a bar chart that takes values from cells A1:B5

In C1 and in D1 I've got two combobox (created with data validation method),
each one allows me to choose 4 different parameters. By changing these
values, the values in A1:B5 and the chart changes too. Now, for every
change of data in C1 and/or D1 I copy & paste the chart to another sheet; in
this situation I've got only ONE chart
Is there a way to obtain a *new* chart every time I change parameter in C1
and D1, so that I can avoid to do the copy & paste the single chart manually
(that is too much time-expensive) and put the it into another sheet ?

Thanks in advance




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #3   Report Post  
uriel78
 
Posts: n/a
Default

Thank you very much, it runs !!!


"Debra Dalgleish" ha scritto nel messaggio
...
You could use an event procedure to do this. Add the following code to
the sheet module, as described he

http://www.contextures.com/xlvba01.html#Worksheet

'=================================
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$C$1" Or _
Target.Address = "$D$1" Then
Charts.Add
With ActiveChart
.ChartType = xlColumnClustered
.SetSourceData Source:=Range("A1:B5")
.Location Whe=xlLocationAsNewSheet
End With
Me.Activate
End If

End Sub
'====================================



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
Zero values in a log chart Joelle_Smith Charts and Charting in Excel 2 May 8th 23 03:42 AM
How to change Series order in a Combination Chart? vrk1 Charts and Charting in Excel 3 April 1st 05 07:21 AM
How to change Series Order in a Combination Chart? vrk1 Excel Discussion (Misc queries) 0 March 31st 05 11:19 PM
How do I change x axis values in a line chart? Elizabeth Charts and Charting in Excel 1 March 29th 05 11:05 AM
Create a Chart with Values from Array AND NOT from Ranges syrhus Charts and Charting in Excel 5 March 19th 05 02:37 AM


All times are GMT +1. The time now is 01:23 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"