HI,
I need to copy a set of columns that starts with name_xxxx and result_xxx from one sheet to another new sheet. I could only manage to copy the entire column. Can anyone help me.
Sample attached.
Appreciate for the help
Regards
Jane
HI,
I need to copy a set of columns that starts with name_xxxx and result_xxx from one sheet to another new sheet. I could only manage to copy the entire column. Can anyone help me.
Sample attached.
Appreciate for the help
Regards
Jane
Re: Copy columns with word starts xxxx and paste to another sheet
Try
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
Re: Copy columns with word starts xxxx and paste to another sheet
Oh mine...this works
Many thanks for this !
Re: Copy columns with word starts xxxx and paste to another sheet
You are welcome.
Don’t have an account yet? Register yourself now and be a part of our community!