返回列表 上一主題 發帖

將工作表1、工作表2符合條件資料以find整合到工作表3問題

試試看
Sub sech()
Dim i As Integer, j As Integer, Rng
Dim Nam As String
For i = 2 To 6
    Nam = Sheets(3).Cells(i, "a")
    Sheets(2).Select
    Set Rng = Range("A:A").Find(What:=Nam, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=True, MatchByte:=False, SearchFormat _
        :=False)
    Sheets(3).Cells(i, "b") = Rng.Offset(, 1)

    '無法切換問題
    Sheets(1).Select
    Set Rng = Range("B:B").Find(What:=Nam, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=True, MatchByte:=False, SearchFormat _
        :=False)
    Sheets(3).Cells(i, "c") = Rng.Offset(, -1)
Next i
End Sub

TOP

        靜思自在 : 屋寬不如心寬。
返回列表 上一主題