| 发表于:2007-08-21 09:12:042楼 得分:100 |
sub calc() dim startrow as integer, endrow as integer dim calcrow as integer, a as string, b as string, c as string, at as single startrow = 1 '这里自己修改要计算的范围 endrow = 100 ' calcrow = startrow with sheet1 do a = .cells(calcrow, 3) b = .cells(calcrow, 2) c = .cells(calcrow, 1) if isnumeric(a) and isnumeric(b) and isnumeric(c) then at = int(a * 10000) - 1 if at > 1000 then at = 1000 at = at / 10000 .cells(calcrow, 4) = (1 - (a - at) - b) * c end if calcrow = calcrow + 1 loop until calcrow > endrow end with end sub | | |
|