Remove and replace non functioning macro buttons

I have a macro that sorts cells A4:B277, at the moment, into alphabetical on column A.

I added a button “Sort Grid References” to run this macro but this has now failed. I now have two buttons neither of which work.

How do I delete these two buttons and replace with one working button.

I attach the relevant sheet, with personal details removed.

Any advice please?

West Essex Convert to Template -Shorter 2024.ods (85.0 KB)

Turn on the form navigator on toolbar “Form Design”.

you have dozens of them,
thus when you delete one, the remaining ones give the impression that you haven’t deleted it.
try to move them a bit, then watch them go when you press Delete:wink:
image

Thank you for your replies.

I went to View > Toolbars > Form Control and checked.

Then entered design Mode then highlighted each button and pressed Cut. There may be much more than dozens. Will return to this tomorrow to clear all remaining buttond, then setup one button again.

Not sure how I created all these buttons?

Did I leave Design Mode ON?

Sorry but more problems.

I eventually cleared all the old push buttons then used this to create a new one:-

This looked OK until I tried to add the Macro when my Malwarebytes kicked in a stopped it with the error:-

Exploit.OfficeSpawningBatchCommands Blocked???

So I turned off Real Time Protection in Malwarebytes and was allowed to load add my Macro to the button.

However when I pushed the button I got this error:-

BASIC runtime error 423 Property or method not found: Sort

I researched and found this URL:-

Suggesting a bug in Office?

This is my Macro:-

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
'Sorting Named Range A-Column-Wise in Ascending Order
Sub Grid_References()

'## 24/11/2023 ##

Set ws = ActiveSheet

Dim rowOne, L

rowOne = 3 'data from row 3 / headings

L = ws.Cells(Rows.Count, “A”).End(xlUp).Row

With ws.Sort

.SortFields.Clear

.SortFields.Add Key:=ws.Range(ws.Cells(rowOne, “A”), ws.Cells(L, “A”)), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

.SetRange ws.Range(ws.Cells(rowOne, “A”), ws.Cells(L, “B”))

.Header = xlYes

.MatchCase = False

.Orientation = xlTopToBottom

.SortMethod = xlPinYin

.Apply

End With

End Sub

Where do I go from here please?

Define a socalled “database range” for your list. Call menu:Data>Define… and check extra option “Contains Header”.
Call menu:Data>Sort… and do the sorting manually.
Install Quick Sort Macros » Extensions, click any cell in the column to be sorted and use the right toolbar button to sort ascending or descending.
The extension macro sorts the defined database range by the active cell’s column according to all the extra options you defined for the sort order and for the database range.