VBA Script adding rows on a worksheet from value on a different sheet

WyldKnyght

New Member
Joined
Feb 11, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm new to VBA scripting, and have tried a few versions posted here, but none seem to work for my layout.

I'm trying to make a sorted grocery list that calculates the lowest price.

I've sorted out all the formulas to get the information, what I can't do is add lines, so the list is cut off, until I manually add rows.

This is what I have so far.

This chart adds the stores in the list and the number of items.

Shopping Value Finder.xlsm
AAAB
2StoreItems
3Atlantic Superstore2
4Giant Tiger2
5Murphy's Pharmacy1
6Sobey's2
7Walmart8
8 
9 
10 
11 
Calculations
Cell Formulas
RangeFormula
AA3:AA7AA3=UNIQUE(FILTER(T3:T300,T3:T300<>""))
AB3:AB11AB3=COUNTIF($T$3:$T$300,AA3)
Dynamic array formulas.


On Sheet2:Summary

Shopping Value Finder.xlsm
AB
1Grocery Store Shopping List
2
3Store:Atlantic Superstore
4Chocolate (Marzipan)
5Flex Straws
6
7Store:Sobey's
8Chicken Broth
9Pizza Pockets (Meat Lover's)
10
11Store:Giant Tiger
12Pizza Pockets
13Chocolate (Sea Salt/Caramel)
14
15Store:Murphy's Pharmacy
16Atoma Pain Relief Gel
17
18Store:Walmart
19Devil's Food Cake Mix
20Golden Yellow Cake Mix
21Mr. Noodles (Chicken/Spicy Chicken)
22Vanilla Extract
23Laundry Stain Remover
24Eggs (Large)
25Italian Seasoning
26International Delight French Vanilla
27
Summary
Cell Formulas
RangeFormula
A3A3=IF(B3 <>"", "Store:", "")
B3B3=IF(Calculations!AB3>0,Calculations!AA3,IF(Calculations!AB4>0,Calculations!AA4,IF(Calculations!AB5>0,Calculations!AA5,IF(Calculations!AB6,Calculations!AA6,IF(Calculations!AB7,Calculations!AA7,IF(Calculations!AB8>0,Calculations!AA8,IF(Calculations!AB9,Calculations!AA9,IF(Calculations!AB10,Calculations!AA10,IF(Calculations!AB11>0,Calculations!AA11,)))))))))
B4:B5B4=FILTER(Calculations!U3:U300,Calculations!T3:T300=B3,"")
A7,A18,A15,A11A7=IF(B7 >"", "Store:", "")
B7B7=IF(B15<>"", IF(Calculations!AB6,Calculations!AA6,IF(Calculations!AB7,Calculations!AA7,IF(Calculations!AB8>0,Calculations!AA8,IF(Calculations!AB9,Calculations!AA9,IF(Calculations!AB10,Calculations!AA10,IF(Calculations!AB11>0,Calculations!AA11,)))))),"")
B8:B9B8=FILTER(Calculations!U3:U300,Calculations!T3:T300=B7,"")
B11B11=IF(B3<>"",IF(Calculations!AB4>0,Calculations!AA4,IF(Calculations!AB5>0,Calculations!AA5,IF(Calculations!AB6,Calculations!AA6,IF(Calculations!AB7,Calculations!AA7,IF(Calculations!AB8>0,Calculations!AA8,IF(Calculations!AB9,Calculations!AA9,IF(Calculations!AB10,Calculations!AA10,IF(Calculations!AB11>0,Calculations!AA11,)))))))),"")
B12:B13B12=FILTER(Calculations!U3:U300,Calculations!T3:T300=B11,"")
B15B15=IF(B11<>"", IF(Calculations!AB5>0,Calculations!AA5,IF(Calculations!AB6,Calculations!AA6,IF(Calculations!AB7,Calculations!AA7,IF(Calculations!AB8>0,Calculations!AA8,IF(Calculations!AB9,Calculations!AA9,IF(Calculations!AB10,Calculations!AA10,IF(Calculations!AB11>0,Calculations!AA11,))))))),"")
B16B16=FILTER(Calculations!U3:U300,Calculations!T3:T300=B15,"")
B18B18=IF(B7<>"", IF(Calculations!AB7,Calculations!AA7,IF(Calculations!AB8>0,Calculations!AA8,IF(Calculations!AB9,Calculations!AA9,IF(Calculations!AB10,Calculations!AA10,IF(Calculations!AB11>0,Calculations!AA11,))))),"")
B19:B26B19=FILTER(Calculations!U3:U300,Calculations!T3:T300=B18,"")
Dynamic array formulas.



Any help and suggestions greatly appreciated

Thanks
C.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I'm also looking from the opposite side, and trying to figure out how to add rows when a #SPILL! error occurs
 
Upvote 0

Forum statistics

Threads
1,215,216
Messages
6,123,669
Members
449,114
Latest member
aides

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top