Hi
first thanks mr.Alex Blakenburg for this code and help me in earlier thread function IsEmpty doesn't work for Workbook_SheetSelectionChange .
second I search for way to make this code is fast
my data will increase from time to another .so my data can reach 3500 rows. by the way I note the code is slight slow even if the data are about 300 rows.
can anybody make this code is fast ?
first thanks mr.Alex Blakenburg for this code and help me in earlier thread function IsEmpty doesn't work for Workbook_SheetSelectionChange .
second I search for way to make this code is fast
my data will increase from time to another .so my data can reach 3500 rows. by the way I note the code is slight slow even if the data are about 300 rows.
can anybody make this code is fast ?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngInputs As Range
Dim rngRows As Variant
Set rngInputs = Intersect(Target, Columns("C:D"))
If Not rngInputs Is Nothing Then
Application.EnableEvents = False
For Each rngRows In rngInputs.Rows
If rngRows.Row <> 1 Then
If IsEmpty(Cells(rngRows.Row, "C")) and IsEmpty(Cells(rngRows.Row, "D")) Then
Cells(rngRows.Row, "E") = 0
Else
Cells(rngRows.Row, "E") = Cells(rngRows.Row, "D") - Cells(rngRows.Row, "C")
End If
End If
Next rngRows
Application.EnableEvents = True
End If
End Sub