Macro expansion across multiple files

The function in question is:

/*****
  Purpose: To increase/decrease the CW message index for the messages displayed at bottom of display.

  Parameter list:
    int direction      was the UP or DN buatton pressed?
    int index          the current index into the CW message array

  Return value:
    int                The new index into the array

  CAUTION:
*****/
int ChangeSwitchIndex(int direction, int index)
{
//  static int count = ELEMENTCOUNT(contestExchanges) - 1;
  static int count = NUM_ELEMENTS(sizeof(contestExchanges), sizeof(contestExchanges[0])) - 1;
  
  if (direction) {
    index++;
    if (index > count)
      index = 1;        // First element to use
  } else {
    index--;
    if (index == 0)     // First element used to erase
      index = count;
  }
  return index;
}

and that code appears in the *.cpp file. I have your function placed in the header file, as I don't want to duplicate it in the other files. Indeed, I would expect it to draw an error if I did.