如何将excel的cells属性对应的表格对应为相应的number号?
例如cells(2,1)对应为a2。

解决方案 »

  1.   

    我是想插入一个函数
    例如sum(b12,b14),这个函数只认number号!
      

  2.   

    function GetCol(M:Integer): String;
    begin
      if M<=26 then
        Result:=char(64+M)
      Else if M<=52 then
        Result:='A'+char(64+M-26)
      Else if M<=26*3 then
        Result:='B'+char(64+M-26*2)
      Else if M<=26*4 then
        Result:='C'+char(64+M-26*3)
      Else if M<=26*5 then
      Result:='D'+char(64+M-26*4)
      Else if M<=26*6 then
      Result:='E'+char(64+M-26*5);
    end;function GetRow(LString: string): Integer;
    var
      list:TStringList;
    begin
      Result:=1;
      lIst:=TStringList.create;
      Try
        list.Text :=Lstring;
        Result:=List.Count ;
      Finally
        list.Free;
      end;end;
      

  3.   

    多谢楼上,难道只能用函数自己处理了?
    excel中没有处理的函数吗?
      

  4.   

    excel 没有相应的函数,它处理的方式是等同,cells(3,2)---cells('B3')
      

  5.   

    function CellsColToNumber(col: integer): string;
    var
        level,remainder:integer;
    begin
        level := col div 26;
        remainder := col mod 26;
        if remainder = 0 then
        begin
            level := level -1;
            remainder := 26;
        end;
        if level > 0 then
            result := CellsColToNumber(level)+char(64+remainder)
        else
            result := char(64+col);
    end;
    改进了一下,就这样了,结贴。