选择案例运行时错误9

时间:2016-07-13 19:27:57

标签: excel-vba select-case vba excel

有时下面的脚本有效,但通常它会在标题中产生错误消息。我已经在对象和变量上设置了监视,并且在发生错误时它们似乎都被定义和/或具有适当的值,因此令人困惑。有什么建议?

List<WebElement> radioButtons = driver.findElements(By.xpath("//input[type=radio]"));
int size = = radioButtons.size();

1 个答案:

答案 0 :(得分:0)

Sheets("Deposit Details")Workbooks("US98 1650 Backup Template.xlsx")中使用已设置为引用Workbooks("US98 1650 Backup Template.xlsx").Sheets("Deposit Details")的DD变量

Public Sub PopulateDepositDetails()

    Set BT = Workbooks("US98 1650 Backup Template.xlsx")

    Set DD = BT.Sheets("Deposit Details")
    Set RDI = BT.Sheets("Raw Database Info")
    LastRowRDI = RDI.Cells(Rows.Count, 1).End(xlUp).Row

    'Define Trading Partner(Company Number) Range
    Dim x, ColX As Range, nrDD, rownum As Integer

    Set ColX = RDI.Range(RDI.Cells(4, 24), RDI.Cells(LastRowRDI, 24))

    nrDD = 2    ' sets Deposit Details sheet next row

    Dim COName As String

    COName = Application.InputBox(Prompt:="Enter Company to Process", _
                                  Title:="ENTER COMPANY", Type:=2)

    If COName = "US96" Or COName = "US97" Or COName = "US98" Or COName = "US99" Or COName = "USZ0" Then

        For Each x In ColX
            If x = COName And x.Offset(0, 4) = "YES" Then
                nrDD = nrDD + 1
                x.EntireRow.Copy Destination:=DD.Range("A" & nrDD)
            End If
        Next

    End If

End Sub
带有Type:= 2的

Application.InputBox将始终返回一个字符串。如果用户取消输入框,它将返回一个空字符串。