code: private int getColumn(String str)
      {
          int ret = 0;
  
          // Find the end of the column characters
          int len = 0;
          for(int i = 0; 
              i < str.length() && str.charAt(i) >= 'A' && str.charAt(i) <= 'Z'; 
              i++, len++);
  
          // Calculate the column number
          int pos = 0;
          for(int i = len-1; i >= 0; i--, pos++)
          {
              char c = str.charAt(i);
              int col = (int)(c - '@');
              if(pos > 0)
                  col *= 26*pos;
              ret += col;
          }
  
          return ret;
      }
docs: Returns the column number from the given cell reference (eg. A1).
  <P>
  eg. A=1, B=2, etc
  @param str The cell reference
  @return The column number for the cell