Bent Rows
A lot of people overlook posture when they are doing rows. Make sure you are using your middle back to stabilize your shoulders.
A good way to check for this is to see if your shoulders roll forward when you are at the top of the row. If they are you will definitely get pain in the area of your shoulder blades.
Pinch your shoulders back first then bend your elbows. This will stabilize Your shoulder joint. Initiating a row at the elbow is a good sign that the upper back needs to be strengthened more.
Switch to a chest supported row for a while so you can focus on technique.
On the flip side this will not cure pain that is already there. Once you heal it will prevent it from happening again.