Bit of a faff. I'd filter the previous month by colour and copy it into current month and add below your data. Then highlight the global codes and conditional format duplicate numbers. You can then apply colour to current month gl codes. Aren't your balance sheet and p&l sequential anyway?
Bit unusual if they aren't.