Thread: worksheet code
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Rod Rod is offline
external usenet poster
 
Posts: 108
Default worksheet code

thank you all... but the first value is placed in sheet2!A2 , I need from
cell A1 in sheet2.. please help me

"Gord Dibben" wrote:

Thanks Sandy.

Wouldn't want to exit without re-enabling events.

Revised version......................

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1")) Is Nothing Then
With Target
If .Value < "" Then
Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp) _
.Offset(1, 0).Value = Target.Value
End If
End With
End If
stoppit:
Application.EnableEvents = True
End Sub


Gord

On Fri, 4 Jan 2008 11:38:11 -0000, "Sandy Mann"
wrote:

I think that Gord may have meant to put the

Application.EnableEvents = False

line after the

If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub

line otherwise if the *If* line causes the sub to terminate then Events will
still be disabled.