Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]() I have a chart loaded onto a Userform and am looking for a way to fit multiple chart options via option buttons. To illustrate, catering for 2 options, I attempted something like the codes below which failed with Type mismatch error. (The variable CharttNme is declared global at module level). What am I doing wrong? David. The codes: Dim CharttNme Private Sub OptionButton1_Click() Call CharttType End Sub Private Sub OptionButton2_Click() Call CharttType End Sub Private Sub CharttType() If OptionButton1.Value = True Then chartNme = xlScatterSmooth ElseIf OptionButton2.Value = True Then chartNme = xlColumnClustered End End If Call GraphTables End Sub Private Sub GraphTables() Charts.Add ActiveChart.ChartType = chartNme *'Type mismatch Error on this line *ActiveChart.SetSourceData Source:=Sheets("Data").Range("A1:C8"), PlotBy:=xlColumns ActiveChart.Location Whe=xlLocationAsObject, Name:="Data" With ActiveChart .HasTitle = True .Axes(xlCategory, xlPrimary).HasTitle = True .Axes(xlValue, xlPrimary).HasTitle = True End With Set ObChart = Sheets("Data").ChartObjects(1).Chart CurrentChart.ChartType = chartNme ' Save chart as GIF fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif" ObChart.Export FileName:=fname, FilterName:="GIF" ' Show the chart Image1.Picture = LoadPicture(fname) Kill fname End Sub Private Sub UserForm_Initialize() OptionButton1_Click End Sub -- davidm ------------------------------------------------------------------------ davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645 View this thread: http://www.excelforum.com/showthread...hreadid=496334 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Format from menu will not offer options or choices? | Excel Discussion (Misc queries) | |||
options to update automatic links | Excel Worksheet Functions | |||
How do I set Save Options? | Excel Discussion (Misc queries) | |||
Options Menu | Excel Discussion (Misc queries) | |||
Excel should allow more options for formatting cells | Excel Worksheet Functions |