Do Until Loop在满足条件时不会停止

时间:2017-03-21 13:52:19

标签: excel vba excel-vba

我有以下代码:

Public Sub CiscoPrimeReport111()
    Dim rowCounter As Long
    Dim colCounter As Long
    Dim throughputAP As Long


    throughputAP = 2
    rowCounter = 8
    colCounter = 1

    MsgBox ("Please do the following before pressing the OK BUtton on this Popup Window!!:" & vbNewLine & vbNewLine & _
        "1. Open the CISCO PRIME AP Report you want to use" & vbNewLine & _
        "2. Select all the data (Ctrl + A)" & vbNewLine & _
        "3. Copy ALL the content (Ctrl + C)" & vbNewLine & _
        "4. NOW YOU CAN PRESS THE OK BUTTON!")


    Application.DisplayAlerts = False
    Call createCiscoSheet


    With ThisWorkbook.Sheets("Cisco Raw")
    .Range("A1").PasteSpecial (xlPasteValues)

        With ThisWorkbook.ActiveSheet.Rows(rowCounter)
            Do Until Cells(rowCounter, colCounter).Value = "AP Statistics Summary"
                ThisWorkbook.Sheets("Throughput Per AP").Rows(throughputAP).Resize(1, .Columns.Count - 1).Offset(0, 1).Value = _
                .Rows(throughputAP).Value '.Resize(1, .Columns.Count - 1).Value
                throughputAP = throughputAP + 1
                rowCounter = rowCounter + 1
            Loop
        End With


    End With
End Sub

代码运行良好,并且直到'循环也运行良好,但在满足以下条件时它不会停止:

Do Until Cells(rowCounter, colCounter).Value = "AP Statistics Summary"

它只是一直循环直到源表的结尾。

任何想法为什么?我是一个菜鸟,所以任何帮助都是值得欣赏的!

0 个答案:

没有答案