E
enyaw
I have the following code which updates a cell once a value is entered into
one of the others.
Private Sub worksheet_calculate()
Application.ScreenUpdating = False
If Range("H5") And Range("I5") > 0 Then
Range("E5") = "900"
ElseIf Range("H5") Or Range("I5") > 0 Then
Range("E5") = "450"
Else
Range("E5") = ""
End If
If Range("H6") And Range("I6") > 0 Then
Range("E6") = "900"
ElseIf Range("H6") Or Range("I6") > 0 Then
Range("E6") = "450"
Else
Range("E6") = ""
End If
If Range("H7") And Range("I7") > 0 Then
Range("E7") = "900"
ElseIf Range("H7") Or Range("I7") > 0 Then
Range("E7") = "450"
Else
Range("E7") = ""
End If
Application.ScreenUpdating = True
End Sub
The problem is it takes a long time for the code to run. Can anyone help?
one of the others.
Private Sub worksheet_calculate()
Application.ScreenUpdating = False
If Range("H5") And Range("I5") > 0 Then
Range("E5") = "900"
ElseIf Range("H5") Or Range("I5") > 0 Then
Range("E5") = "450"
Else
Range("E5") = ""
End If
If Range("H6") And Range("I6") > 0 Then
Range("E6") = "900"
ElseIf Range("H6") Or Range("I6") > 0 Then
Range("E6") = "450"
Else
Range("E6") = ""
End If
If Range("H7") And Range("I7") > 0 Then
Range("E7") = "900"
ElseIf Range("H7") Or Range("I7") > 0 Then
Range("E7") = "450"
Else
Range("E7") = ""
End If
Application.ScreenUpdating = True
End Sub
The problem is it takes a long time for the code to run. Can anyone help?