Seamlessly loop through LED's - Shift Register
You mean something like this? (untested):

void loop() {
  // use static or global variables to remember positions (these are initialized only once):
  static uint8_t hi_pos = 0;  // where HIGH should be set
  static uint8_t lo_pos = 21; // where LOW should be set

  setRegisterPin(hi_pos, HIGH); // turn on led in head
  setRegisterPin(lo_pos, LOW);  // turn off led in tail
  writeRegisters();             // update registers

  // ensure it won't overflow:
  if (++hi_pos == 24) hi_pos = 0;
  if (++lo_pos == 24) lo_pos = 0;

  // or:  hi_pos = (hi_pos+1) % 24;  // but divisions are slower on AVR

  delay(100);
}


It will go in sequence:

ON  OFF
 0   21
 1   22
 2   23
 3    0
 4    1
...
22   19
23   20
0    21
...


forever