VBA给出错误13"类型不匹配"数据类型范围

时间:2018-05-23 13:15:15

标签: excel vba debugging

我正在尝试编写一个代码,从列中获取特定名称,并在下一个列中与日期匹配,

Sub ContractDates()

    Dim StatusValue As Range
    Dim QuotationOpen As Range
    Dim DateWriter As Range
    Dim x As Long
    Dim rFind As Range

    lastrow = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row

    For x = 2 To lastrow
        Set StatusValue = Cells(x, 4)
        For Each c In StatusValue
            If StatusValue = "DESIGN" Then
                Set QuotationOpen = Cells(x, 3)
                For Each v In QuotationOpen
                    If QuotationOpen = "Q3ING18" Then
                        Set DateWriter = Cells(x, 7)
                        Let DateWriter = "28/09/2018"
                    End If
                Next
            End If
        Next
    Next

End Sub

而且它给出了我说

这一行的错误
If QuotationOpen = "Q3ING18" Then

但不是说

If StatusValue= "DESIGN" Then

尽管他们都是'范围' 我无法弄清楚为什么

0 个答案:

没有答案