Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Worksheet Change Event - copy cell to another sheet

I'm coding a Worksheet Change event to trigger when a cell changes. It works
well so far. The problem is I want to copy a cell from this worksheet to
another worksheet. When I specify the other worksheet, the cell gets copied
wherever the cursor was positioned in the target worksheet - not in the cell
I want. here is the copy code:

Range("BC3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Test1").Select
Range("Test1!B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False


The worksheet Change event is in the worksheet code - so this may be the
problem. Is it possible to do this? Thanks for any help on this.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Worksheet Change Event - copy cell to another sheet

Sheets("Test1").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

--
Gary''s Student - gsnu200907


"dhstein" wrote:

I'm coding a Worksheet Change event to trigger when a cell changes. It works
well so far. The problem is I want to copy a cell from this worksheet to
another worksheet. When I specify the other worksheet, the cell gets copied
wherever the cursor was positioned in the target worksheet - not in the cell
I want. here is the copy code:

Range("BC3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Test1").Select
Range("Test1!B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False


The worksheet Change event is in the worksheet code - so this may be the
problem. Is it possible to do this? Thanks for any help on this.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Worksheet Change Event - copy cell to another sheet

When the code is in a worksheet module, the unqualified ranges belong to the
sheet with the code. In a general module, the unqualified range belongs to the
activesheet.

So you could qualify the ranges:

Range("BC3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Test1").Select
Sheets("Test1").Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

But even better is to drop all those .select's and just assign the value:

worksheets("test1").range("B3").value = me.range("bc3").value

If you really wanted, you could still do the copy|paste special|values, too:

me.range("Bc3").copy
worksheets("test1").range("b3").pastespecial paste:=xlpastevalues





dhstein wrote:

I'm coding a Worksheet Change event to trigger when a cell changes. It works
well so far. The problem is I want to copy a cell from this worksheet to
another worksheet. When I specify the other worksheet, the cell gets copied
wherever the cursor was positioned in the target worksheet - not in the cell
I want. here is the copy code:

Range("BC3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Test1").Select
Range("Test1!B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

The worksheet Change event is in the worksheet code - so this may be the
problem. Is it possible to do this? Thanks for any help on this.


--

Dave Peterson
Reply
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 Change Event Tony S.[_2_] Excel Discussion (Misc queries) 11 February 18th 09 01:04 AM
Worksheet change Event ranswert Excel Worksheet Functions 1 January 17th 08 11:17 PM
Cancel sheet change event NSK Charts and Charting in Excel 1 July 17th 07 08:25 PM
change event on specific cell rather than worksheet frendabrenda1 Excel Discussion (Misc queries) 10 September 21st 06 03:37 AM
Worksheet Row Change event crazybass2 Excel Discussion (Misc queries) 4 December 8th 04 05:29 PM


All times are GMT +1. The time now is 05:22 PM.

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

About Us

"It's about Microsoft Excel"