How to sort columns automatically when any cell is updated?

Msears

Board Regular
Joined
Apr 14, 2022
Messages
56
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
I looked over previous threads and can't seem to find on solution to tackle this. I want this sheet to auto sort by Date (Oldest to Newest), Domain (Alphabetical), Goal (Smallest to Largest), every time new data is entered? And if there is code for it to separate by domains entered that would be great to have too, for example an empty row between different domains? I hope this makes sense?
 

Attachments

  • 50DA1AE6-741C-4BDF-9059-1F68E6FF9698.jpeg
    50DA1AE6-741C-4BDF-9059-1F68E6FF9698.jpeg
    149.1 KB · Views: 11
Thanks Bebo. the code above is working for the most part, except it needs to include Column E in its sorting. That way it will list Goal 1-whatever, within that domain. Can that be incorporated?
Hello Bebo. I think I have been starring at this too long! When I type in the first domain, in this case is "Echoic" and type in a second domain, in this case is "Imitation", it will enter it, but when I choose another domain, it will just override the second entry and will not let me proceed? Any ideas?
Bebo, could it be because the code is attached to my user form and not the sheet itself?
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Just gues:
You may need to refresh emptyRow again, after new input:
VBA Code:
'sort the table
emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
Range("B2:Z" & emptyRow).Sort key1:=Range("c2"), key2:=Range("b2"), key3:=Range("D2")
'Loop from bottom, then insert blank row. If there are too many rows may reduce code speed, ask me to try another code.
For i = emptyRow To 2 Step -1
If i > 2 And Cells(i, 3).Value <> Cells(i - 1, 3).Value Then Cells(i, 3).EntireRow.Insert
Next
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,022
Latest member
RobertV1609

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