I did some research and came up with the following code:
Sub FlowerOrderWizard()
' Keyboard Shortcut: Ctrl+t
'
' Declares the ranges that will be copied and/or cleared.
Dim SrtRange As Range
Dim OrderRange As Range
Dim ClrOrderRange As Range
Set SrtRange = Sheets("Flower Order Entry").Range("B2")
Set OrderRange = Sheets("Flower Order Entry").Range("B4:W27")
Set ClrOrderRange = Sheets("Flower Order Entry").Range("E4:W26")
' Selects and copies the flower order range from "Flower Order Entry" B4:W27,
' including the "END" tag at B27 used by the loop to find the end of the table
Sheets("Flower Order Entry").Activate
OrderRange.Select
Selection.Copy
Sheets("Total Flower Order").Activate
Dim loopBool As Boolean
loopBool = True
Sheets("Total Flower Order").Range("A1").Activate
Do While loopBool = True
If ActiveCell.Value = "END" Then
loopBool = False
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop
' Pastes the data copied from "Flower Order Entry" to end of the table
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Returns the user to the "Flower Order Entry" tab and clears the ranges for
' Group Name and the quantity of flats
Sheets("Flower Order Entry").Activate
ClrOrderRange.ClearContents
SrtRange.ClearContents
SrtRange.Select
End Sub
Then the SUMPRODUCT function uses some dynamic named ranges to total all entries by flower type and color in "Total Flower Order"AA2:AS24
=IF(SUMPRODUCT((RefRng_CommonNames=$Z2)*(Rng_FlowerColor=AA$1)*Ary_AllFlowerOrders)=0,"",SUMPRODUCT((RefRng_CommonNames=$Z2)*(Rng_FlowerColor=AA$1)*Ary_AllFlowerOrders))
If anyone has any feedback on this approach, I'd really appreciate it. Please see the attached sample.
Bookmarks