A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Worksheet Change Event - copy cell to another sheet



 
 
Thread Tools Display Modes
  #1  
Old October 12th, 2009, 06:18 PM posted to microsoft.public.excel.misc
dhstein
external usenet poster
 
Posts: 665
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  
Old October 12th, 2009, 06:23 PM posted to microsoft.public.excel.misc
Gary''s Student
external usenet poster
 
Posts: 7,584
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  
Old October 12th, 2009, 06:35 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:45 PM.


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