用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 dim i as integer dim nph as single dim xa as single dim ya as single dim xb as single dim yb as single dim q as single dim r as integer dim xf as single dim xd as single 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 + 0.0000000001))) / (q / (q - 1 + le - 10)) - (r / (r + 1))) yd = q / (q - 1 + 0.0000000001) * ((xa / (r + 1) + (xf / (q - 1 + le - 10))) / (q / (q - 1 + 0.0000000001))) - (r / (r + 1)) - xf / (q - 1 + 0.0000000001) 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) xcz(i) = activesheet.cells(i*2-1,11) ycz(i) = activesheet.cells(i*2-1,12) 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查看更多