MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Event Handler Problem


Posted by Aclark on June 26, 2001 9:59 AM

I have the following code to print the date and time
whenever certain rows in an excel sheet are modified,
unfortunately any time the worksheet is opened it also
changes that date, even if none of the values in the
rows have been changed.
Does anyone know how I could make sure that my
Worksheet_Change code is not triggered by the opening
of the Excel file?

Private Sub Worksheet_Change(ByVal Target As Range)
UserInput = Target.Value
ThisRow = Target.Row
If IsNumeric(UserInput) And ThisRow < 4 Then
If Target.Value > 0 Then
Range("R2") = "=NOW()"
Range("R3") = Target.Value
End If
End If
End Sub


Thanks
Aaron


Posted by Ivan F Moala on June 26, 2001 10:27 PM

Change the line of code that reads;
Range("R2") = "=NOW()" TO
Range("R2") = Now()
It isn't the sheet event tha is changing it
It is the calculation of the formula upon openning
of the =Now().


HTH

Ivan