【发布时间】:2019-10-03 10:46:54
【问题描述】:
我正在尝试创建一个简单的用户表单来绘制选定列的图表。
我目前所做的如下代码所示:
Public Sub UserForm_Initialize()
Dim Axis As Variant
Dim Axis1 As Variant
Axis = Rows(1).Value
' here I'm filling the Comboboxes with all the names in the 1st row
ComboBox1.Column = Axis
ComboBox2.Column = Axis
End Sub
Public Sub Plot_Click()
With Range("A1:ZZ1")
'Here I'm searching for the column index of the selected value in the first Combobox
Set rFind1 = .Find(What:=ComboBox1.Value, LookAt:=xlWhole, _
MatchCase:=False, SearchFormat:=False)
End With
Spalte1 = rFind1.Column
With Range("A1:ZZ1")
'Here I'm searching for the column index of the selected value in the second Combobox
Set rFind2 = .Find(What:=ComboBox2.Value, LookAt:=xlWhole, _
MatchCase:=False, SearchFormat:=False)
End With
Spalte2 = rFind2.Column
'somewhere here, I would like to plot a graph with the selected
'column indexes (Spalte1 and Spalte2)
End Sub
Private Sub Schliessen_Click()
'here I'm closing the userform
Unload Me
End Sub
图表应如下所示:
而且在未来,我还会添加更多的组合框,以便选择更多的轴来绘制
感谢每一个答案/帮助和建议
【问题讨论】:
标签: excel vba indexing graph charts