希望你好。請在嘗試了很多但沒有成功後請專家幫忙。根據組合框中的兩個標準返回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謝謝!我編輯了這個問題,我在 –