PDA

View Full Version : Macro to run at change of cell value without hitting enter key



ravikr2678
07-16-2009, 03:39 PM
Hello team,

I'm working with a macro which runs at change of cell values.
eg: if i enter some value in cell D10 and hit enter then the macro runs.

however, I have a situation where the value in to cell D10 comes from a link.
i mean, input from another application.
So hitting on enter key after value with in D10 changes is not possible.
due to which the macro do not run.

Below is the code.


Private Sub Worksheet_Activate()
UpDates
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C10:D10")) Is Nothing Then
UpDates
End If
End Sub

Private Sub UpDates()
Dim TgtRow As Long, i As Long
Application.EnableEvents = False
TgtRow = 10
For i = 2 To TgtRow - 1
If Cells(i, 1) = Cells(TgtRow, 1) Then
Cells(TgtRow, 1).EntireRow.Copy Cells(i, 1)
End If
Next
Application.EnableEvents = True
End Sub



Is there any way that the macro can run without hitting enter key for D10 ?

mumin_abdul
07-16-2009, 03:55 PM
how exactly is the cell retrieving the data?

ravikr2678
07-16-2009, 04:48 PM
The cell is linked to a component called 'Input Text' in Xcelsius.
when ever i enter a date in to 'Input text' component, the same is reflected within excel cell.

mdmackillop
07-17-2009, 12:29 AM
Only "simple" method I can think is to have an OnTime macro running. This could compare every 10 secs (or other interval) present and previous value of a cell by having a non-updating value in another location.

ravikr2678
07-17-2009, 06:10 AM
Thank you, I'm going try that.

mumin_abdul
07-23-2009, 01:06 PM
The best method would be to use threading. But I dont know if its possible with Excel