Essentially, this is what I would like to do:

In this case X# will represent an unknown column that increases as categories are created. The table is in Sheet A and new column Sheet B. Sheet A is set up where Column B grabs headers from F1:X# and all items are auto sorted.
---
For Table F2:X# convert and place in A1 of Sheet B
Delete blank cells
Sort
---

Is it possible to have this script run as changes are made, or does it need to be applied as a macro? I would prefer automation as I do not want to forget to apply it. My previous set up includes a macro button and some awful equations.

Thanks for your help! I'll be checking back regularly.