VBA Code for Sorting

soumen21

New Member
Joined
Aug 16, 2019
Messages
35
Dear Experts,

I have a set of data as shown below

[TABLE="width: 211"]
<tbody>[TR]
[TD="align: left"]Category A[/TD]
[TD="align: left"]Name[/TD]
[TD]Due Year[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Sam[/TD]
[TD]2021[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]John[/TD]
[TD]2020[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Tony[/TD]
[TD]2024[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Rahul[/TD]
[TD]2020[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Harry[/TD]
[TD]2023[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: left"]Category B[/TD]
[TD="align: left"]Bill[/TD]
[TD]2021[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Tom[/TD]
[TD]2022[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Steve[/TD]
[TD]2020[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Alan[/TD]
[TD]2024[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]Walter[/TD]
[TD]2021[/TD]
[/TR]
</tbody>[/TABLE]

I want to create tabs with three different colors which will show the list data as per conditions.
Category A Red Yellow Green
Category B Red Yellow Green

When I click on Red tab of Category A, it will list all names with due date 2020 or earlier
When I click on Yellow tab of Category A, it will list all names with due date between 01-01-2021 to 12-31-2023
When I click on Yellow tab of Category A, it will list all names with due date after 01-01-2024

and similarly for Category B.

When I click on Red tab of Category B, it will list all names with due date 2020 or earlier
When I click on Yellow tab of Category B, it will list all names with due date between 01-01-2021 to 12-31-2023
When I click on Yellow tab of Category B, it will list all names with due date after 01-01-2024

Any help?

Regards
Soumen
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top