Wow, that macro will come handy in the next time I mess things up.
In my case all I want is getting rid of the dupes. The channel mess is from a former MIDI channels setup, but now I have all MIDI notes directly on the instrument tracks, so no neeed for the different channels.
Why not Dissolve the part into separate MIDI tracks and delete one of the resultant tracks?
(Page 931 of the manual)
"Dissolving Parts into Separate Channels
You can dissolve MIDI parts that contain events on different MIDI channels, and distribute the
events into new parts on new tracks, one for each MIDI channel found.
Select the parts that contain MIDI events on different channels.
Select MIDI > Dissolve Part.
Activate Separate Channels.
For each MIDI channel used in the selected parts, a new MIDI track is created and set to
the corresponding MIDI channel. Each event is copied into the part on the track with the
corresponding MIDI channel, and the original parts are muted."