-1

こんにちは、私の問題は、コードが (i, 1) を検索して "Hello" を見つけるときです。それは見つかりますが、WSS に送信されません。

Sub AddSelection()

Dim WSD As Worksheet ' Sheet 1 as prices sheet
Dim WSW As Worksheet ' Workings sheet as Information
Dim WSS As Worksheet ' Selections worksheet

Set WSD = Worksheets("Selection")
Set WSW = Worksheets("Workings")
Set WSS = Worksheets("Selections")

' Loop through records on WSD column A

FinalRow = WSD.Cells(Rows.Count, 1).End(xlUp).Row
    For i = 5 To FinalRow
        If WSD.Cells(i, 1) = "Hello" Then


        ' When I run the code this where the problem is
        WSD.Cells(i, 1).Copy Destination:=WSS.Cells(NextRow, 4)


        NextRow = NextRow + 2

        FinalRow = WSS.Cells(Rows.Count, 1).End(xlUp).Row

    End If
Next i

'Make sure WSR is the active sheet
WSS.Select


' Report that the macro is done
MsgBox prompt:=NextRow - 1 & " Results Records Are Copied To Worksheet."


End Sub
4

1 に答える 1