Hi Sige,
Thats what I thought and nothing happened ... my workbook got on
Manual Calc, maybe thats why.
The calculation setting should have no bearing.
Are you sure that the code has been pasted into the code module behind the
active worksheet?
If so, perhaps you have inadvertently disabled events. To eliminate this
possibility, paste the following code into a standard module:
Sub AAA
Application.EnableEvents = True
End Sub
After running this sub, try deleting the contents of cell A1, which should
produce the required message text in A1.
Is it possible to set the range.... on the cell in last row in
column D?
If your intention is that the cell after the last populated cell in column D
should display the message text, then try instead:
'=====================>>
Private Sub Worksheet_Calculate()
Dim rng As Range
Dim LastCell As Range
Dim rcell As Range
Dim sStr As String
Const IntCol As Long = 4
sStr = "Double Click Me"
Set LastCell = Cells(Me.Rows.Count, IntCol).End(xlUp)(2)
Set rng = Range(Cells(1, IntCol), LastCell)
On Error GoTo XIT
Application.EnableEvents = False
For Each rcell In rng.Cells
If rcell.Value = sStr Then rcell.ClearContents
Next rcell
Set LastCell = Cells(Me.Rows.Count, IntCol).End(xlUp)(2)
LastCell.Value = sStr
XIT:
Application.EnableEvents = True
End Sub
''<<=====================
Unlike the previous procedure, this code responds to the worksheet's
calculate event and, therefore, requires that calculation should not be set
to manual.
In order to coerce the calculation event, you might consider including a
volatile worksheet function (such as Now(), Indirect(), Offset)) somewhere
in the sheet.