Many thanks, Fixo!! I stepped into the code and found it that it only changes the color if the layer was locked. I tweaked it a little and it works great.
Sorry, Lucas. I debated on whether or not to start a new thread, but I thought the code was related enough to use this one.