View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Shuvro Basu Shuvro Basu is offline
external usenet poster
 
Posts: 19
Default Selecting charttype from macro is not working

Hi Ivan,

I tried as suggested. However the value is not returned. This is the
code I am using :
This is in the listbox click

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
CommandButton2.Visible = True
chrttype = 0
chrttype = chartform.ListBox1.Column(1, chartform.ListBox1.ListIndex)


This is in the process command button

Private Sub CommandButton2_Click()
On Error Resume Next
Dim ct As Integer
Dim chrttype As String
Dim chrtype As Long
Dim mypos As Long
ct = ComboBox1.Value
MsgBox str(chrttype)
'---------- I dont get a return value here.... I have put the values in
the sheet and named the range as listrange which is mapped to the
listbox1. The values are displayed without any issues. But not returned
here when the user has clicked.

'On Error Resume Next
If ct = 0 Then
MsgBox "Please select a series value from the list to continue..."
Exit Sub
Else
ActiveChart.SeriesCollection(ct).Select
ActiveChart.SeriesCollection(ct).ChartType = chrttype
ActiveChart.SeriesCollection(ct).Select
End If
CommandButton2.Visible = False
ListBox1.Visible = False
End Sub

Hence not sure what is not working here!!

regds