Sort Dynamic Table with Condition

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the below table, what I need is to sort the numbering by ascending order, it's easy if I have a fixed table, but the challenge is this table is dynamic, it changes whenever I change the EE ID. Can you help me with the formula that solve this issue?

[TABLE="width: 512"]
<tbody>[TR]
[TD="width: 64"]EE ID[/TD]
[TD="width: 64"]AAAA[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD]KEY_EEID[/TD]
[TD]Goal#[/TD]
[TD]Goal Overall Progress[/TD]
[TD]Objective[/TD]
[TD]Category[/TD]
[TD]Metric/Outcomes[/TD]
[TD]Active/Deleted[/TD]
[TD]Numbering[/TD]
[/TR]
[TR]
[TD]AAAA1[/TD]
[TD="align: right"]1[/TD]
[TD]NO[/TD]
[TD]BBBBBB[/TD]
[TD]OE[/TD]
[TD]nnnnn[/TD]
[TD]Active[/TD]
[TD="align: right"]3.2[/TD]
[/TR]
[TR]
[TD]AAAA2[/TD]
[TD="align: right"]2[/TD]
[TD]NO[/TD]
[TD]CCCCC[/TD]
[TD]OE[/TD]
[TD]jjjjj[/TD]
[TD]Active[/TD]
[TD="align: right"]3.1[/TD]
[/TR]
[TR]
[TD]AAAA3[/TD]
[TD="align: right"]3[/TD]
[TD]YES[/TD]
[TD]KKKK[/TD]
[TD]BE[/TD]
[TD]eee[/TD]
[TD]Active[/TD]
[TD="align: right"]4.2[/TD]
[/TR]
[TR]
[TD]AAAA4[/TD]
[TD="align: right"]4[/TD]
[TD]YES[/TD]
[TD]LLLL[/TD]
[TD]OE[/TD]
[TD]rrr[/TD]
[TD]Active[/TD]
[TD="align: right"]1.1[/TD]
[/TR]
</tbody>[/TABLE]



Thank you
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi,

It seems to me the dynamic part is in fact when you are changing the Key_EEID ....

If it is the case, an event macro could run your Sort macro as soon as you are changing anything in Column A ...

Hope this will help
 
Upvote 0
Hi,

Thank you for your respond! Yes, you're right. Can you please share the suggested macro?
 
Upvote 0
Hi again,

In your sheet module, you could test following:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 1 Then Exit Sub
If Target.Target > 1 Then Exit Sub
Dim last As Long
last = ActiveSheet.Cells(Application.Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Range("A1:H" & last).Sort [A1], xlAscending, Header:=xlYes
Range("A1").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Hope this will help
 
Upvote 0
I copied the macro to my sheet and when I tried to run it, it didn't show this macro in my drop-down list of macros, I even copied it to a new workbook and the same happened. Is there anything I can do to fix? I have named the range of each column if you want I can share them with you?
 
Upvote 0
Hi,

That's super great! thank you so much for your help and guidance.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
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