In the absence of a sample workbook, data, code or selection criteria ... let's assume you have a workbook with a Source Worksheet and a Target worksheet. Let's also assume that your Source worksheet has populated columns A to K, number of rows is relevant, but not for this example. For the sake of argument, let's say you have a header with letters A to K as the column headers, and the data is in rows 2 to 14.
In the Target worksheet, put the letters A,B,H,I, and G, in that order, in cells A1 to E1.
Now, starting with the Source worksheet, record a macro. You first need to select the Target sheet, because you can only output the filtered data to the selected sheet. Then choose Data | Advanced Filter on the ribbon. Choose A1:K14 on the Source worksheet as the source data, and A1:E1 on the Target worksheet for the filtered output. Click OK. Stop recording.
You get this:
So, that needs tidying up to avoid the selections and to determine how many rows of data are in the source range. But, that's basically it. Start with the Target sheet is key, and specify the columns you want, in the order that you want them.
Regards, TMS
Bookmarks