Valspar posts third-quarter gains