Automatic sort of table into rank order when a new record is added

Peter Cresswell

New Member
Joined
May 20, 2018
Messages
2
Hi Everyone,
Although I have used Excel to produce simple spread sheets, I am new to using VBA and macros. I am struggling with creating a macro that will do a fairly simple task and I have found a YouTube video that seems to do what I want but having created it by heavily copying from the video it doesn't run against my data table.
The data table has simply two columns Column A records a name and Column B records a time in seconds to 1/100 th of a second. This is
for a slot car racing feature at a local charity fete and records and sorts the times and the names with them automatically when a new name and time are added. This is an example of the table. The data
from the lap timer
would be entered manually on the next line blow the end of the table
sprint leader board table.jpg


Note the table can be either as long as necessary or have a limit of say top 25 times providing the slowest times drop off the bottom.

When a new row is added (name in col A and time in Col B) when I press 'Enter' I want the table to sort the new data into its position in the current table. This is the macro I have which as I mentioned above has been heavily borrowed from a youtube video, but my needs are to have a name (i.e alpha characters) in col A whereas the one in the video used numeric.
macro.jpg
.

The last time I ran the macro it resulted in a pop-up box that referred to a syntax error and the 2 lines were highlight in yellow and blue

The video on YouTube can be viewed at: https://www.bing.com/videos/search?...E5E308D14561DF600E2BE&view=detail&FORM=VIREHT<strike>
</strike>
Any help that you can offer would be appreciated, but I have spent a few days now reading about macros and haven't been able to resolve the issues. Now I'm panicking because I need this for Saturday!!!!!

Many thanks
Pete
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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