functions
Hi Mike,
this worked for me when ever I entered a value into A3...
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$3" Then
Dim rgOldValues As Range
Dim iLastRow As Long
iLastRow = Me.Cells(Range("A:A").Rows.Count, 1) _
..End(xlUp).Row
Application.EnableEvents = False
Select Case iLastRow
Case 1
Case 2
Case 3
Range("A4").Value = Range("A3").Value
Case Else
Set rgOldValues = Me.Range("A4:A" & iLastRow)
rgOldValues.Cut _
Destination:=Me.Range("A5:A" & iLastRow + 1)
Range("A4").Value = Range("A3").Value
End Select
Application.EnableEvents = True
End If
End Sub
Could be a horse of a different colour though when the change is from
an opc server.
To get the code in place...
1. Copy it
2. Right click the worksheet's sheet tab then select "View Code" from
the popup menu.
3. Paste the code into the worksheet's code module that appears.
4. Press Alt + F11 to get back to the worksheet.
Ken Johnson
|