VBA to copy data if multiple criteria are met

前端 未结 4 471
鱼传尺愫
鱼传尺愫 2020-12-06 21:18

I am trying to create a VBA code which copies into Sheet \"Results\" the data in the third column of the below tab when the criteria \"Lukas\" in the first column and \"Appl

4条回答
  •  鱼传尺愫
    2020-12-06 21:47

    Any particular reason you want to do this with VBA, instead of a good old PivotTable?

    Here's how.

    Select a cell in your range and turn it into an Excel Table using the Ctrl+T keyboard shortcut:

    Select a cell in the resulting Table and turn it into a PivotTable by choosing Insert>PivotTable

    This gives you an empty PivotTable 'canvas' on a new sheet:

    Add all three fields to the ROWS area, and either filter them as required using the filter dropdowns in the PivotTable or by adding Slicers as I've shown here:

    Any time you add more data to the initial sheet, simply right-click on the PivotTable to refresh it to include the new data.

提交回复
热议问题