Could someone tell me why this macro isn't working?

You might want to use this version then