lcASCIIcode=65 rows = 1 cols = 1 Do while .not. eof() WITH oExcel .Cells(rows,Cols).formula = "=SUM("+CHR(65)+LTRIM(str(7))+":"+CHR(65)+LTRIM(str(rows))+")" & & Result is =sum(A7:Axx) Endwith skip cols = cols + 1 rows = rows + 1 lcASCIIcode= lcASCIIcode + cols enddo 2. But when i tried to substitute the chr(66) into the following codes below so that Chr(66) would become chr(67) for the next loop and chr(68) on the next loop , it resulted into errors (expected results are from =sum(A7:Axx) then to =sum(B7:Bxx) , then to =sum(C7:Cxx) .and so on......) lcASCIIcode=65 rows = 1 cols = 1 Do while .not. eof() WITH oExcel .Cells(rows,Cols).formula = "=SUM("+CHR(lcASCIIcode)+LTRIM(str(7))+":"+CHR(lcASCIIcode)+LTRIM(str(rows))+")" Endwith skip cols = cols + 1 rows = rows + 1 lcASCIIcode= lcASCIIcode + cols enddo I also tried this one but doesnt work also .Cells(rows,Cols).formula = "=SUM("+CHR(STR(lcASCIIcode))+LTRIM(str(7))+":"+CHR(STR(lcASCIIcode))+LTRIM(str(rows))+")"Any help is highly appreciated,