excel vba搜索多个标准

时间:2017-07-20 03:39:39

标签: excel vba excel-vba

当我运行这个VBA宏时,尽管输入了不同的护士ID,但我得到了相同的结果,感谢此代码来自我观看的视频,并且已经过修改以符合多个标准

action = Bezier(bezier_conf.path1, 5)   # Moves the sprite using the
sprite.do(action)                       # bezier path 'bezier_conf.path1'
                                      # in 5 seconds

1 个答案:

答案 0 :(得分:3)

根据我上面的评论,您的代码也在为Select Case而不是您的多个Or而尖叫。

<强> 代码

Sub finddata()

Dim nursenumber As String
Dim finalrow As Integer
Dim i As Integer
Dim course As Integer
Dim nurserow As Integer

nursenumber = InputBox("please enter nurse number")
nurserow = InputBox("please enter nurse row")
finalrow = Sheets("S1").Range("A10000").End(xlUp).Row
course = ADORIE

With Worksheets("S1")
    For i = 2 To finalrow
        If .Cells(i, 1) = nursenumber Then
            Select Case .Cells(i, 7).Value
                Case "FIRE"
                    .Cells(i, 9).Copy Destination:=Worksheets("database").Cells(nurserow, 2)

                Case "CPRNURL4", "BUCPRBYS", "CPRACLSR", "CPRADULT", "CPRALIED", "CPRBASIC", "CPRBYST", "CPRCO567", "CPRMANHA", "CPRMCORP", "CPRNURL4"
                    .Cells(i, 9).Copy Destination:=Worksheets("database").Cells(nurserow, 3)

            End Select
        End If
    Next i
End With

End Sub