for i=66 to fcount()+65
columnname=chr(i-1)+"3"
activecellname=columnname
cvalue=allt(field(i-65))
if vartype(&cvalue)="C"
select max(len(alltrim(&cvalue))) from (tablename) into array awidth
mx=iif(len(allt(cvalue))<=awidth,awidth,len(allt(cvalue)))
hb1.range(activecellname+":"+activecellname).columnwidth=mx*1.5
else
if vartype(&cvalue)$"NYFI"
select max(len(alltrim(str(&cvalue,12,2)))) from (tablename) into array awidth
mx=iif(len(allt(cvalue))<=awidth,awidth,len(allt(cvalue)))
hb1.range(activecellname).columnwidth=mx*1.5
endif
endif
HB1.range(activecellname).FormulaR1C1=cvalue
endfor
j=4
go top
do while not eof()
for s=66 to fcount()+65
columnname=chr(s-1)+allt(str(j))
activecellname=columnname
cvalue=allt(field(s-65))
if vartype(&cvalue)="C"
HB1.range(activecellname).FormulaR1C1="'"+allt(&cvalue)
else
if vartype(&cvalue)$"NYFI"
HB1.range(activecellname).FormulaR1C1=&cvalue
endif
endif
endfor
skip
j=j+1
enddo