This code works for right columns, but i want for left columns data
![]()
Sub MatchAndCopy2() Dim i As Long, k As Long, n As Variant, rSource As Range, rMatch As Range, rng As Range Dim s As String, t As String Application.ScreenUpdating = False s = InputBox("Please enter the File Name") t = InputBox("Please enter the Start Range") With Workbooks(s).Sheets("1st WB Sheet1") Set rSource = .Range(t, .Range(t).End(xlDown)) End With With Workbooks(s).Sheets("2nd WB Sheet1") Set rMatch = .Range("A2", .Range("A2").End(xlDown)) '.Columns("U:X").Clear End With For Each rng In rMatch 'rng.Interior.ColorIndex = 0 n = Application.Match(rng.Value, rSource, 0) If IsNumeric(n) Then With rng.Resize(, 4) .Value = rSource.Rows(n).Resize(, 4).Value '.Interior.ColorIndex = 35 End With ' Uncomment these two lines if you want copied to Sheet3 also 'k = k + 1 'rSource.Rows(n).Resize(, 5).Cut Sheets("Sheet3").Rows(k) Else 'rng.Interior.ColorIndex = 3 End If 'i = i + 1 Next rng Application.CutCopyMode = False Application.ScreenUpdating = True Windows(s).Activate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks