一旦找到值,VBA就会抬起一个标志

时间:2015-03-27 14:24:37

标签: excel vba excel-vba find

一旦使用.Find方法找到值,我就会尝试引发标记。问题在于.Find。它不起作用。它应该是一个标志为真,但事实并非如此。这些值存在于Repasse.Range("A2:A" LastFindRange)中,它只是无法识别它们。有什么想法吗?

Dim Book As Workbook
Dim Calypso As Worksheet
Dim Repasse As Worksheet
Dim LastFindRange as Long
Dim LastCalypso as Long
Dim Flag as Boolean

Set Book = Workbooks("Novo Email - Caixa Offshore")
Set Calypso = Workbooks("Novo Email - Caixa Offshore").Worksheets("Calypso")
Set Repasse = Book.Worksheets("Exceções Repasse")
LastFindRange = Repasse.Cells(Rows.Count, "A").End(xlUp).Row
LastCalypso = Calypso.Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To LastCalypso
Flag = True
On Error Resume Next
Set FindSting = Repasse.Range("A2:A" & LastFindRange).Find(Calypso.Range("D" & i).Value)
If FindString Is Nothing Then
    Flag = False
Else: Flag = True
End If

1 个答案:

答案 0 :(得分:0)

我是个白痴。

我将FindString作为范围并使用FindSting - 没有“r”。

所以这都是一个错字。