Hi all
I am relatively new to VBA so this problem is beyond me at present. It's a conditional sort but with logic so cannot be achieved in the normal multi column conditions. The first example is what I begin with and you can see the logic that this is two families where column A is the persdons age, B is a key field and C is just for information.
The logic concerns the childrens age and logically what parents they can belong to so what I want to achieve in this example is below but it's just beyond me at present and looks like I will need to swap rows or something.
Thanks in advance for any insight or help, I'm sure an example of how to do this will help me build further and achieve what I want.
I am relatively new to VBA so this problem is beyond me at present. It's a conditional sort but with logic so cannot be achieved in the normal multi column conditions. The first example is what I begin with and you can see the logic that this is two families where column A is the persdons age, B is a key field and C is just for information.
Code:
A B c
1. 67 0 husband
2. 33 0 husband
3. 71 1 wife
4. 31 1 wife
5. 29 2 son
6. 9 2 son
7. 37 3 daughter
8. 4 3 daughter
The logic concerns the childrens age and logically what parents they can belong to so what I want to achieve in this example is below but it's just beyond me at present and looks like I will need to swap rows or something.
Code:
A B c
1. 67 0 husband
2. 71 1 wife
3. 37 3 daughter
4. 29 2 son
5. 33 0 husband
6. 31 1 wife
7. 9 2 son
8. 4 3 daughter
Thanks in advance for any insight or help, I'm sure an example of how to do this will help me build further and achieve what I want.