In worksheet wsb,I am trying to copy column B and Column having ParName in header and pasting it to columns B & H respectively of worksheet wso. The problem is It's running only for first Item and also for the first matched value of i for that item and not for all the matched item-i values.
Dim ws, wsa, wsb, wsc, wso As Worksheet
Dim index1b, LastRow, MOLastRow, wsoLastRow As Long
Dim ColLtr1b As Variant
Dim MoNameArr
Set wsb = Workbooks(Y).Sheets("REF")
wsb.Activate
LastRow = GetLastRow(wsb, 2)
Arr = Array("Abc", "Def")
Set wso = Workbooks(W).Sheets("Output")
For Each Item In Arr
    For i = 2 To LastRow
        If Cells(i, 2).Value = Item Then
            wsb.Activate
            ParName = wsb.Cells(i, 3).Value
            Set wsc = Workbooks(M).Sheets(Item)
            wsc.Activate
            index1b = Application.Match(ParName, wsc.Rows(1), 0)
            If Not IsError(index1b) Then
                ColLtr1b = Replace(wsc.Cells(1, index1b).Address(True, False), "$1", "")
                MOLastRow = wsc.Cells(Rows.Count, 2).End(xlUp).Row
                Range("B2:B" & GetLastRow(wsc, 2)).Copy
                wso.Activate
                wsoLastRow = GetLastRow(wso, 2)
                Range("B" & wsoLastRow + 1).Select
                ActiveSheet.Paste
                wsc.Activate
                Range(ColLtr1b & "2:" & ColLtr1b & GetLastRow(wsc, 2)).Copy
                wso.Activate
                Range("H" & wsoLastRow + 1).Select
                ActiveSheet.Paste
            End If
        End If
    Next i
Next Item
 
     
    