Board logo

标题: [VBA] 请高手帮助解决工程量计算表的二次输入问题(#value) [打印本页]

作者: wangzc    时间: 2006-12-31 12:00     标题: 请高手帮助解决工程量计算表的二次输入问题(#value)

有一个工程量计算表VB如下:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.MoveAfterReturn = False
    Rem 在此处加入计算式
    Dim RowNum As Long, ColumnNum As Long
    RowNum = Target.Row
    ColumnNum = Target.Column
    If Cells(RowNum, ColumnNum) = "" Then
        Application.MoveAfterReturnDirection = xlDown
        “Application.MoveAfterReturn = True
        Exit Sub
    End If
    Cells(RowNum, ColumnNum + 1) = Evaluate(Application.WorksheetFunction.Substitute _
                (Application.WorksheetFunction.Substitute(Cells(RowNum, ColumnNum), "[", "*ISTEXT(""["), "]", "]"")"))
    Cells(RowNum, ColumnNum) = Application.WorksheetFunction.Substitute _
                    (Application.WorksheetFunction.Substitute(Cells(RowNum, ColumnNum), "*", "×"), "/", "÷")
   
    Application.MoveAfterReturn = True
    Application.MoveAfterReturnDirection = xlDown
    Cells(RowNum + 1, ColumnNum).Select
End Sub


计算表只支持一次输入,如果再次点击的话,那结果项就会变成#value了,那将是十分不雅,请高手相助,解决这个问题,谢谢
作者: kingbor    时间: 2007-1-4 09:12     标题: 试试吧

你所说的只输入一次,是只能在EXCEL中只能赋一次值吧!  可否将你再点击的格赋为空呢? cell(x,y)="" 或=0  ,这样可否!




欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/) Powered by Discuz! 6.0.0