I've got a current macro which I'm using that works perfectly, at this point I'm just fine-tuning it (it's the same project from my previous thread).
I'd like to add some code that organizes the spreadsheet based on column B, "Producer". The cells contain the initials of all my coworkers, and I'd like to sort them alphabetically. However, I want to sort it in a way that the oldest entries remain on top for each group of initials. Each row is a current prospect, thus I want to keep the oldest prospects at the top for each producer.
New prospects will just be added in the next available row, and the macro needs to be able to identify which prospects need to get sorted.
For example, if the current sheet looks like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Prospect[/TD]
[TD="align: center"]Producer[/TD]
[/TR]
[TR]
[TD]Prospect1
[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect2[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect11[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect3[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect10[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect4[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect5[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect8[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect7[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect9[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect12[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect13[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect14[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect15[/TD]
[TD]GB[/TD]
[/TR]
</tbody>[/TABLE]
I want it to look like this afterwards:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Prospect[/TD]
[TD="align: center"]Producer[/TD]
[/TR]
[TR]
[TD]Prospect1[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect2[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect11[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect13[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect3[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect10[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect12[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect4[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect5[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect8[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect15[/TD]
[TD]GB
[/TD]
[/TR]
[TR]
[TD]Prospect7[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect9[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect14[/TD]
[TD]RA[/TD]
[/TR]
</tbody>[/TABLE]
Can anybody lend a hand? Thanks!
Eric
I'd like to add some code that organizes the spreadsheet based on column B, "Producer". The cells contain the initials of all my coworkers, and I'd like to sort them alphabetically. However, I want to sort it in a way that the oldest entries remain on top for each group of initials. Each row is a current prospect, thus I want to keep the oldest prospects at the top for each producer.
New prospects will just be added in the next available row, and the macro needs to be able to identify which prospects need to get sorted.
For example, if the current sheet looks like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Prospect[/TD]
[TD="align: center"]Producer[/TD]
[/TR]
[TR]
[TD]Prospect1
[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect2[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect11[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect3[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect10[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect4[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect5[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect8[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect7[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect9[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect12[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect13[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect14[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect15[/TD]
[TD]GB[/TD]
[/TR]
</tbody>[/TABLE]
I want it to look like this afterwards:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Prospect[/TD]
[TD="align: center"]Producer[/TD]
[/TR]
[TR]
[TD]Prospect1[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect2[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect11[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect13[/TD]
[TD]DB[/TD]
[/TR]
[TR]
[TD]Prospect3[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect10[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect12[/TD]
[TD]FS[/TD]
[/TR]
[TR]
[TD]Prospect4[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect5[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect8[/TD]
[TD]GB[/TD]
[/TR]
[TR]
[TD]Prospect15[/TD]
[TD]GB
[/TD]
[/TR]
[TR]
[TD]Prospect7[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect9[/TD]
[TD]RA[/TD]
[/TR]
[TR]
[TD]Prospect14[/TD]
[TD]RA[/TD]
[/TR]
</tbody>[/TABLE]
Can anybody lend a hand? Thanks!
Eric