-1

次のコードで型の不一致エラーが発生します。なんで?

If (Range("C:C").Find(What:=last_received, After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False)) is Nothing Then
        tic = 1
    End If

また、Range変数を作成してnotingに設定し、以下のコードを使用しましたが、それでも同じエラーが発生します:

If (Range("C:C").Find(What:=last_received, After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False)) = rr Then
        tic = 1
    End If
4

2 に答える 2

0

(OP、murugan_kotheesanに代わって投稿)

mehowのおかげです。以下は最終的な作業コードです

    Sheets("Extract -prev").Select
    Application.Goto Reference:="R1C3"        'taking last received ticket
    Selection.End(xlDown).Select
    last_received = ActiveCell.Value
    Selection.Copy
    Sheets("Calc").Select
    Application.Goto Reference:="Yesterday_last_received"
    ActiveSheet.Paste

'----------changing last received ticket if it is not available in todays ticket

    Sheets("Extract").Select
    Range("A1").Select
    Worksheets("Extract").AutoFilterMode = False
    Selection.AutoFilter

   lr = ActiveSheet.Range("C" & Rows.Count).End(xlUp).Row
   For Each rr In Range("C1:C" & lr)
       If rr Like last_received Then
            tic = 0
       End If
   Next

    Do While (tic <> 0)
        Sheets("Extract -prev").Select
        Selection.Offset(-1, 0).Select
        last_received = ActiveCell.Value

        Sheets("Extract").Select
        Range("A1").Select
        Worksheets("Extract").AutoFilterMode = False
        Selection.AutoFilter

        lr = ActiveSheet.Range("C" & Rows.Count).End(xlUp).Row
        For Each rr In Range("C1:C" & lr)
        If rr Like last_received Then
        tic = 0
        End If
        Next
    Loop
于 2014-10-10T06:38:54.560 に答える