A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Pull down menu (combo box) on chart sheet



 
 
Thread Tools Display Modes
  #1  
Old March 18th, 2004, 08:07 PM
Pablo
external usenet poster
 
Posts: n/a
Default Pull down menu (combo box) on chart sheet

Hello:

Would like to have a full-sized chart worksheet that has a pull-down
menu on it so I can select a different product to show while viewing
the chart.

I can do this fairly simply in a regular worksheet where the chart,
data, and the pull-down menu exist all on the same worksheet. However,
if I make the chart's location a new sheet, then I can't use the pull
down menu without flipping back to my data sheet.

Found a posting with the following code and it's almost what I need,
but want to be able to use a pull-down menu instead of the regular
list -- See Sub Tester1():

****************************************
Martin,
Here is one way you can attack this:

Sub Tester1()
Set lb = Charts(1).Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
With lb.ControlFormat
.ListFillRange = "Sheet1!A1:A10"
.MultiSelect = xlSimple
End With
End Sub

Sub tester2()
With Charts(1).Shapes(1).OLEFormat.Object
For i = LBound(.Selected) To UBound(.Selected)
Debug.Print i, .Selected(i), .List(i)
Next
End With
End Sub

HTH,
Tom Ogilvy
****************************************

Thanks!
  #2  
Old March 18th, 2004, 10:33 PM
Jon Peltier
external usenet poster
 
Posts: n/a
Default Pull down menu (combo box) on chart sheet

Pablo -

Change xlListBox to xlDropDown in the second line of code.

You can do this easily enough manually. Get the chart and the dropdown
working on one sheet, copy the chart to another sheet, and copy the
control to the same sheet. You then need to reformat the control, making
sure that the sheet name is in front of the list fill range and linked
cell (i.e., Sheet1!$A$1:$A$10 instead of just $A$1:$A$10).

You can even change the chart to a chart sheet, and paste the control on
the chart.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______

Pablo wrote:

Hello:

Would like to have a full-sized chart worksheet that has a pull-down
menu on it so I can select a different product to show while viewing
the chart.

I can do this fairly simply in a regular worksheet where the chart,
data, and the pull-down menu exist all on the same worksheet. However,
if I make the chart's location a new sheet, then I can't use the pull
down menu without flipping back to my data sheet.

Found a posting with the following code and it's almost what I need,
but want to be able to use a pull-down menu instead of the regular
list -- See Sub Tester1():

****************************************
Martin,
Here is one way you can attack this:

Sub Tester1()
Set lb = Charts(1).Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
With lb.ControlFormat
.ListFillRange = "Sheet1!A1:A10"
.MultiSelect = xlSimple
End With
End Sub

Sub tester2()
With Charts(1).Shapes(1).OLEFormat.Object
For i = LBound(.Selected) To UBound(.Selected)
Debug.Print i, .Selected(i), .List(i)
Next
End With
End Sub

HTH,
Tom Ogilvy
****************************************

Thanks!


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.