LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Help with event code

Note the 3rd line of code from the end where
I instruct my code to copy my entire sheet1 in order
To paste it to a newly created sheet (NewSheet)
Why does a new workbook get created with the copy?

TIA,


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("d2")) Is Nothing Then
Exit Sub
End If
If Target.Address = "$D$2" Then
Sheets.Add After:=Worksheets(Worksheets.Count - 2)
End If
NewSheet = ActiveSheet.Name
Sheets("Sheet1").Activate
ActiveSheet.Copy '' <<<< ????? Why does this line Open a New
' Workbook an Copy my data into it <<the new ' workbook?
Sheets(NewSheet).Activate
ActiveSheet.Paste
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Event Code John Excel Programming 2 June 18th 04 12:46 PM
help worksheet event code scott23 Excel Programming 2 January 6th 04 08:17 PM
Add event code through a macro Hans Bergman Excel Programming 1 October 31st 03 07:04 PM


All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"