Here's a step-by-step guide on how to set it up:
1) In Razor, go into Macros tab. Create a new macro, name it however you like and click "Record". Leave it recording for now.

2) Go into Hotkeys tab. Look for Targets > Non-Friendly Targets. Select Target Closest Non-Friendly and click "Execute Selected".

3) Still in Targets, select Attack Last Target and click "Execute Selected".

4) Go back to your macro and stop recording it. It should look like the image below. Now click on "Set HK" to assign a hotkey to it.

5) It will take you back to the Hotkeys tab. Select your new macro, assign a hotkey to it and click "Set". I use Alt Z personally.

6) Lastly, go into Friends tab and make sure "Treat party members as Friends" is enabled, so the macro ignores your party members.

And it's done! Now, every time you hit that hotkey, you'll start attacking the enemy closest to you. Enjoy!