I have Power Query table in an Excel spreadsheet that filters a different table for a specific Index number using a List Box of Client Names.
The first table has 3 columns:
| Index | Attribute | Value |
|---|---|---|
| 1 | Attribute 1 | Value A |
| 1 | Attribute 2 | Value B |
| 2 | Attribute 1 | Value C |
| 2 | Attribute 2 | Value D |
| 3 | Attribute 1 | Value E |
| 3 | Attribute 2 | Value F |
I used a list box which has a list of client names, which when selected, updates a table. So if I selected Client 1 in the list box, the table would update to say:
| Attribute | Value |
|---|---|
| Attribute 1 | Value A |
| Attribute 2 | Value B |
The code to update this table is pretty simple and I haven't had any issues with it until recently.
ActiveWorkbook.Worksheets("Sheet Name").ListObjects("Table_Name").QueryTable.Refresh BackgroundQuery:=False
I have recently started getting Error 7 Out of memory, especially when I let the spreadsheet sit. When I hit 'Debug', it always highlights this section of code. I am not sure how to go about diagnosing what is causing this issue. I have read the documentation from Microsoft, but am not sure where to start troubleshooting this for my own situation.
Here is the Power Query code:
let Source = Excel.CurrentWorkbook(){[Name="Review_Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"Attribute", type text}, {"Value", type text}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Index] = #"Name Filter")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index"}),
#"Added Index" = Table.AddIndexColumn(#"Removed Columns", "Index", 1, 1, Int64.Type)
in #"Added Index"