I have a sheet with multiple tables on the same worksheet 'Sheet1' separated by a blank row.
I want the VBA to sort one by one.
Considerations
- Each table has different amount of rows
- In the future, the columns amount will also change
What will always be the same is:
- The blank row between tables on column B, which is meant to be the starting point for excel to recognize there is a new table.
- Each table will always be sorted by column C
To give you a better picture, I am looking at consumer data cross tabs, where:
COLUMN A is QUESTION TYPE
COLUMN B is ANSWER CHOICES
COLUMN C is Header is "TOTAL", and it contains % per answer choices
The rest of COLUMS follow % like C but with different headers like "male" "female" "user" "non user" "Age 18-25" "Age 26-34"....etc.
I want to create a looped macro that will sort each table (and all the columns within the table) by Column C in ascending order identifying that it has to search for the next blank space and the table will be below it.
I've tried looking at Looping, Sorting, and finding the next empty cell. But I can't put the pieces together for some reason.
Any help will be GREATLY appreciated!
Previous code tried:
Dim oneArea as Range
For Each oneArea in Range("C:C").SpecialCells(xlCellTypeConstants).Area
oneArea.EntireRow.Sort key1:=oneArea.Cells(1,1), order1:=xlAscending
Next oneArea
For ref: This one is the closest example and macro i've found to what im going for, but it doesn't apply to my scenario / couldn't make it work: