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