achin
05-06-2008, 08:47 PM
HI.. I've wrote the source code below to compare values of column A and B.
It's run and perform as what I need it to be done.
But when I keyed in data in Column A and B.. and it give me the output too..but the screen of Excel sheet is shaking.. and it's obvioulsy looping for few seconds.
How to stop the shaking?
Besides, the when there's delays, it's displayed as: "Days Delayed-7"
I prefer to have Days "Delayed: 7"
Can anyone teach me how to do this?
p/S: input value of column A & B are in dates (dd.mm.yyyy)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
With Cell
If Cell = "" Then
Cells(.Row, "C").Value = ""
Else
If Cells(.Row, "A").Value > Cells(.Row, "B").Value Then
Cells(.Row, "C").Value = "On Time"
Else
Cells(.Row, "C").Value = "Days Delayed" & Cells(.Row, "A") - Cells(.Row, "B")
End If
End If
End With
Next Cell
End Sub
It's run and perform as what I need it to be done.
But when I keyed in data in Column A and B.. and it give me the output too..but the screen of Excel sheet is shaking.. and it's obvioulsy looping for few seconds.
How to stop the shaking?
Besides, the when there's delays, it's displayed as: "Days Delayed-7"
I prefer to have Days "Delayed: 7"
Can anyone teach me how to do this?
p/S: input value of column A & B are in dates (dd.mm.yyyy)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
With Cell
If Cell = "" Then
Cells(.Row, "C").Value = ""
Else
If Cells(.Row, "A").Value > Cells(.Row, "B").Value Then
Cells(.Row, "C").Value = "On Time"
Else
Cells(.Row, "C").Value = "Days Delayed" & Cells(.Row, "A") - Cells(.Row, "B")
End If
End If
End With
Next Cell
End Sub