View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sharad Naik Sharad Naik is offline
external usenet poster
 
Posts: 212
Default WorkSheet Event - Copied

1) Instead of copying sheet you insert a new sheet and copy the used rage in
sheet OrdEnt to the new sheet.
e.g.:
Dim newSheet As Worksheet
Set newSheet = Worksheets.Add(After:=OrdEnt)
With Worksheets("OrdEnt").UsedRange
.Copy Destination:=newSheet.Cells(.Cells(1, 1).Row, .Cells(1,
1).Column)
End With

2) OR in the Worksheet_SelectionChange code of OrdEnt, Add following line
at the top:
If Not Me.Name = "OrdEnt" Then Exit Sub
So the code will be copied to new sheet, event will be fired but will exit
immediately with above
first line.

3) OR see below link - how to remove the code, through VBA
http://www.cpearson.com/excel/vbe.htm

Sharad


"RWN" wrote in message
...
xl2k on win2kPro.

I have a workbook that has a "Worksheet_SelectionChange" event on the
initial sheet that
works just fine.

Once entry is complete the user runs a macro (located in a separate
module) that copies
the sheet (creates another sheet in the same workbook via "OrdEnt.Copy
After:=OrdEnt").

Works fine, except;
The worksheet change event can still be fired on the newly created
(copied) sheet.
I suppose I could copy/paste the sheet to get rid of the change event but
was wondering if
there's another way?

Hints?
--
Regards;
Rob
------------------------------------------------------------------------