Analogue to digital conversion for volume control

Comment #1: every one of your cases in your switch/case is the same.
Comment #2: digitalwrite takes about 3.5 microseconds (give or take) to switch the state of a pin - you need to give time for the switch to respond
Comment #3: you don't use ledPin anywhere
Comment #4: you don't keep track of the current volume
Comment #5: I think they meant the "insert code" button in the toolbar - you can also type in [ code ] and [ / code ] without spaces.

Take a look at this:

const int sensorMin = 23;      // sensor minimum, discovered through experiment
const int sensorMax = 1000;    // sensor maximum, discovered through experiment
const int VOL_UP = 9;          // VOL UP connected to digital pin 9 through 4016
const int VOL_DOWN = 10000;    // I assume your volume down is similar to your 
                               // volume up

int volume;

void volumeUp() {
  digitalWrite(VOL_UP, HIGH); // toggle the pin high
  delay(10); // wait for it to be recognized
  digitalWrite(VOL_UP, LOW); // turn it back off
  delay(10);
  volume++;
}

void volumeDown() {
  digitalWrite(VOL_DOWN, HIGH); // toggle the pin high
  delay(10); // wait for it to be recognized
  digitalWrite(VOL_DOWN, LOW); // turn it back off
  delay(10);
  volume--;
}

void setup() {
  // initialize serial communication:
  Serial.begin(9600); 
  
  // ensure that the volume is set to 0
  // by pressing the down button 15 times
  for (uint8_t i = 0; i < 15; i++) {
    volumeDown();
  }
  volume = 0;
}

void loop() {
  // read the sensor:
  int sensorReading = analogRead(A0);
  // map the sensor range to a range of 15 options:
  int range = map(sensorReading, sensorMin, sensorMax, 0, 14);
  
  // volume is higher than the one read, set it back down to what it should be.
  while (volume > range) {
    volumeDown();
  }
  
  // volume is lower than the one read, set it up until its equal
  while (volume < range) {
    volumeUp();
  }
  
  // volume should now be equal to the one set on the pot
  Serial.print("Volume: ");
  Serial.print(volume);
}

Please tell if the code makes sense to you.