希望你好。请在尝试了很多但没有成功后请专家帮忙。根据组合框中的两个标准返回Textbox1值,并且标签
我有3列在Sheet1的价格表:
医疗程序
类型
程序
用户窗体中的价值,我需要在Textbox1的返回程序的基础上的价值在combobox1中选择的条件(具有可在Sheet1中Medical Procedure列中找到的值)和label1中的标题(其中alrealdy中填充了可在Sheet1的Type列中遇到的值)。
我试过在用户B哈特(感谢,B哈特!)的计算器中发现此处,但我无法将其更改为以数值形式返回到文本框中(此vba将找到的值插入一个列表框)。另一个问题是,下面的标准是在两个组合框中。我需要两个标准在一个组合框中,另一个在标签中。
Private Sub GetCondStrandValue()
Dim iRow As Long
Dim strValue As String
strValue = vbNullString
If Me.ComboBox1.Value = vbNullString Or Me.ComboBox2.Value = vbNullString Then Exit Sub
With Planilha1
For iRow = 2 To .Range("A65536").End(xlUp).Row
If StrComp(.Cells(iRow, 1).Value, Me.ComboBox1.Value, 1) = 0 And _
StrComp(.Cells(iRow, 2).Value, Me.ComboBox2.Value, 1) = 0 Then
strValue = .Cells(iRow, 3).Value
Exit For
End If
Next
End With
If strValue = vbNullString Then Exit Sub
With Me.ListBox1
'If you only want a single value in the listbox un-comment the .clear line
'Otherwise, values will continue to be added
'.Clear
.AddItem strValue
.Value = strValue
.SetFocus
End With
End Sub
@DirkReichel谢谢!我编辑了这个问题,我在 –