用excel的宏求解精馏塔塔板数,编码错误。求大神指导, ...? excel文件里为空,确定有代码? 不好意思,我第一次用宏。可能我保存的时候方法错了没有了。这是我编的代码 sub hong() dim xcz(100) as variant dim ycz(100) as variant dim xph(100) as variant dim yph(100) as variant dim u(100) as variant dim v(100) as variant for i = 1 to 100 u(i) = activesheet.cells(i, 6) v(i) = activesheet.cells(i, 5) if u(1) = 1 and u(i) = 0 then nph = i if u(1) = 0 and u(i) = 1 then nph = i next i xa=activesheet.cells(1£¬15) ya=activesheet.cells(1£¬15) xb=activesheet.cells(2£¬15) yb=activesheet.cells(2£¬15) q=activesheet.cells(3£¬15) r = activesheet.cells(4, 15) xf=activesheet.cells (5£¬15) xd=((xa/(r+1)+(xf/(q-1 +1e-10)))/((q/(q-1+le-10)ò»(r/ (r+1)) yd=q/(q-1 +1e-10)*((xa/(r+1)+(xf/(q-1+le-10)))/((q/(q-1+1e-10) -(r/(r+1))ò»xf / (q-1+1 e-10) activesheet.cells(6, 15) = xd activesheet.cells(6, 16) = yd xc = xa yc = ya for i = 1 to 100 xcz(i) = xc ycz(i) = yc xc = chazhi(u, v, yc, npl) xph(i) = xc yph(i) = yc activesheet.cells(i, 1) = xph(i) activesheet.cells(i, 2) = yph(i) activesheet.cells(i*2-1£¬11)=xcz(i) activesheet.cells(i*2-1£¬12)=ycz(i) activesheet.cells(2 * i, 11) = xph(i) activesheet.cells(2 * i, 12) = yph(i) if xc xd and xph(i) 1 and g then k = k - 1 v = 0 for i = k to k + 2 l = 1 for j = k to k + 2 if i j then l = l * (u - x(j)) / (x(i) - x(j)) next j v = v + l * y(i) next i chazhi = v end function 查看更多