I believe the range command would work. Since you're removing a command that may, or may not, be defined, it shouldn't raise an issue on the interfaces where it's not defined.
Only issue that comes to mind, if you try a range command for interfaces that don't exist, then I believe the command will fail.