我運行代碼VBA
測試是否細胞右邊是小於0,如果是,則使活動單元格0。這應該運行在小區被輸入。這是我到目前爲止有:VBA計算單元格值之前如果/然後聲明
Private Sub worksheet_change(ByVal target As Range)
If Not Intersect(target, Range("c7:c27")) Is Nothing Then isNegative
End Sub
然後
Sub isNegative()
Dim cell As Range
If ActiveCell.Offset(1, 0).Value < 0 Then
ActiveCell.Value = 0
End If
End Sub
但是,我認爲正在發生的事情是,它在計算前檢查數據。我該如何解決?
'Application.Calculate'? – Gaffi 2013-04-24 14:05:16