No.
You can assign hotkeys - such as setting a single button to a single key, like assigning a button on a Razer Deathadder to the key 3 for fishing rod.
However, macros are not allowed.
Macros are when you assign a single key or combination of keys to perform a larger task, such as pressing a button on your mouse to do 3>rightclick>1 in order to switch to fishing rod, cast it, then switch back to sword. That's an example of a macro, which isn't allowed.