Vandals have caused considerable damage to two historic buildings in Yorkshire after daubing grafitti on the walls.