Thread: worksheet code
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Sandy Mann Sandy Mann is offline
external usenet poster
 
Posts: 2,345
Default worksheet code

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.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


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

This is sheet event code. Right-click on the sheet tab of Sheet1 and
"View
Code".

Copy/paste the code into that sheet.

First value entered in Sheet1!A1 will go into Sheet2!A2 then A3, A4 etc.


Gord Dibben MS Excel MVP

On Thu, 3 Jan 2008 19:56:00 -0800, Rod
wrote:

Hi
Happy New Year to all.
I need a code that each time I enter value in cell A1 of sheet1 should be
placed in column A of sheet2.. I mean if I enter values in sheet1!A1 one
after another it should be placed in sheet2!A1 and second value in
sheet2!A2
and so on.

thanks in advance.