-1
我希望有人可以帮助我以下。 我有一张表格,每行都有客户/患者记录(从第3行开始)和56列医疗数据(条件,药物等)进行搜索。我有一个用户窗体和几个组合框来选择项目或组合我搜索的项目。我做了一个脚本来搜索项目的组合。问题在于结果甚至不能达到结果。VBA脚本来搜索值的组合
Private Sub cmdCOMBI_Click()
Dim COMBIRange As Range
Dim LastRow As Long
Dim LastCol As Long
Dim cbo1 As String
Dim cbo2 As String
Dim cbo3 As String
Dim Par1 As Integer
Dim Par2 As Integer
Dim Par3 As Integer
Dim conb As Integer
LastRow = Worksheets("SOURCE").Cells(Rows.Count, 1).End(xlUp).Row
Set COMBIRange = Worksheets("SOURCE").Range("A2:BO" & LastRow)
If Not cboINCL1.TEXT = "" Then
cbo1 = cboINCL1.Value
Par1 = 1
Else
cbo1 = "--"
Par1 = 0
End If
If Not cboINCL2.TEXT = "" Then
cbo2 = cboINCL2.Value
Par2 = 1
Else
cbo2 = "--"
Par2 = 0
End If
If Not cboINCL3.TEXT = "" Then
cbo3 = cboINCL3.Value
Par3 = 1
Else
cbo3 = "--"
Par3 = 0
End If
ParTotal = Par1 + Par2 + Par3
conb = 0
For iR = 3 To LastRow
For iC = 11 To 67
If Worksheets("SOURCE").Cells(iR, iC).Value = cbo1 Or Worksheets("SOURCE").Cells(iR, iC).Value = cbo2 Or Worksheets("SOURCE").Cells(iR, iC).Value = cbo3 Then
INC = INC + 1
End If
Next iC
If INC = ParTotal Then
conb = conb + 1
End If
Next iR
FormMENU.tboResIN.Value = conb
End Sub
任何人,我做错了什么idee?
预先感谢您!
您是否尝试通过按F8单步执行代码并确定发生错误的位置? – MP24
使用F8没有发现错误,但我发现脚本正在计算从第一场比赛到下一场比赛的行数,而不是匹配数。仍然不知道解决方案应该是什么。 –