Copy columns with word starts xxxx and paste to another sheet

  • Re: Copy columns with word starts xxxx and paste to another sheet


    Try

    Code
    Sub test()
        Dim x, ws As Worksheet
        Set ws = Sheets.Add
        With Sheets("sheet1").Cells(1).CurrentRegion
            x = Filter(.Parent.Evaluate("if((left(" & .Rows(1).Address & ",4)=""name"")+(left(" & _
            .Rows(1).Address & ",6)=""result"")," & .Rows(1).Address & ",char(2))"), Chr(2), 0)
            ws.Cells(1).Resize(, UBound(x) + 1).Value = x
            .AdvancedFilter 2, ws.Cells(1).CurrentRegion, ws.Cells(1).CurrentRegion
        End With
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!