Copy Power Query result data to a Table object

Copper Contributor

Hi all,

 

I'm using Excel 365, in a workbook I have :

 

1. Worksheet in which I have a Power Query running, the PQ is taking a sub-set of data from a different file.

At the moment the PQ filter is static although I need to change it so the single filter it's using will be based on a value I will choose on the worksheet. 

 

The result of the PQ is made out of four columns with a changing number of rows

 

2. On a separate worksheet, I have a Table object which has five columns (one more field which needs to be manually entered) and I need to auto-populate the four columns from the PQ (the table is empty)

 

I have little experience in PQ manipulations using VBA, can someone please help with either guidance or VBA code to help? 

 

Thank you,

Ronnen

4 Replies

@rnnbr Perhaps best if you upload a file or a link to a shared file one OneDrive (or similar), as it's difficult to picture what you want to do otherwise.

@Riny_van_Eekelen 

Hi, I couldn't upload a file but I've built below something that I hope can explain better:

 

The screen capture of the worksheet below contains the results of a PQ, you can see four columns: Name, Lead, Position, location

rnnbr_0-1652121828268.png

This is the next worksheet in which I want the PQ data to populate, it is easy to see which data goes where as the column names are the same, apart from Priority Position, which has to be entered manually after the table has been populated  

 

(the future question is how to amend the PQ via VBA to change the filter by the lead entered in say cell E1)

rnnbr_1-1652121862248.png

 

Is this easier to understand? 

@rnnbr Yes and no. I see what your are working on but don't really understand what you need. You have a table that comes out of PQ (the green one) and then you want to include it in the blue one where extra information is added. Perhaps you want to add a column to a PQ generated table and keep this additional information synchronised when you refresh PQ. If so, that's possible if you follow some basic steps. Google for "self referencing table power query" and you'll find many resources that describe the process. 

@Riny_van_Eekelen for various reasons I need to populate the Table, not only that there is more logic on it but it’s then being used by other worksheets, I’ll try to start uncovering how to loop through the PQ results and copy the data to the Table