Private Sub Worksheet_Change(ByVal Target As Range) Dim i% If Not Target.Address Like "$[CEFGHI]$*" Then Exit Sub i = Target.Row If Application.CountA(Cells(i, 1), Range(Cells(i, 3), Cells(i, 7))) <> 0 Then Cells(i, 5).FormulaR1C1 = "=单价" Cells(i, 5) = Cells(i, 5).Value Cells(i, 7).FormulaR1C1 = "=收入" Cells(i, 7) = Cells(i, 7).Value Cells(i, 9).FormulaR1C1 = "=油料" Cells(i, 9) = Cells(i, 9).Value Cells(i, 12).FormulaR1C1 = "=工资" Cells(i, 12) = Cells(i, 12).Value Cells(i, 14).FormulaR1C1 = "=营业税" Cells(i, 14) = Cells(i, 14).Value Cells(i, 16).FormulaR1C1 = "=成本合计" Cells(i, 16) = Cells(i, 16).Value Cells(i, 17).FormulaR1C1 = "=利润" Cells(i, 17) = Cells(i, 17).Value End If End Sub 兰老师,上面的代码是过去别上帮我写的,但过去只是在一列里求数,现在我在过去的基础上增加了很多列,在运行的时候,CPU总是100%,根本无法得到结果,最后只好结束任务,请帮助改一下代码,使其运行快点,另外红色部份我不知道是什么意思,请帮助解释一下.谢谢!
楼主能否传个附件上来,我总感觉代码太麻烦了。
[此贴子已经被兰色幻想于2006-6-10 12:42:43编辑过] |