I know with my G500 I can macro that, it really depends on the mouse's software.

Any gaming mouse from logitech or ricer will be able to do this with the included software.