Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default PasteSpecial value

Here are two example of Code. Trying to copy Range of cells from SourceWS to
TargetWS.

This code working fine, as I have formula at Source its copy Formul.
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy vTargetWS.Range("F"
& vTargetLastRow)

I tried to use PasteSpecial in result receiving Syntex Error
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy _
vTargetWS.Range("F" & vTargetLastRow).PasteSpecial Paste:=xlPasteValues

Whats worng!

Regards
Atif
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default PasteSpecial value

delete the underscore character

--


Gary Keramidas
Excel 2003


"Atif" wrote in message
...
Here are two example of Code. Trying to copy Range of cells from SourceWS to
TargetWS.

This code working fine, as I have formula at Source its copy Formul.
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy vTargetWS.Range("F"
& vTargetLastRow)

I tried to use PasteSpecial in result receiving Syntex Error
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy _
vTargetWS.Range("F" & vTargetLastRow).PasteSpecial Paste:=xlPasteValues

Whats worng!

Regards
Atif


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default PasteSpecial value



The following worked for me:

Worksheets("Sheet1").Range("B5").CurrentRegion.Cop y
Worksheets("sheet2").Range("C10").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False

Perhaps the problem is that you have a line continuation character
sequence (<space<underscore) at then end of the line that ends with
Copy, so the two lines beginning with vSourceWS and VTargetWS are
being combined into a single line of code, and the resulting code is
not syntactically correct. Get rid of the "_" at the end of the line
and you should be all set.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]





On Tue, 5 Jan 2010 13:53:01 -0800, Atif
wrote:

Here are two example of Code. Trying to copy Range of cells from SourceWS to
TargetWS.

This code working fine, as I have formula at Source its copy Formul.
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy vTargetWS.Range("F"
& vTargetLastRow)

I tried to use PasteSpecial in result receiving Syntex Error
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy _
vTargetWS.Range("F" & vTargetLastRow).PasteSpecial Paste:=xlPasteValues

Whats worng!

Regards
Atif

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default PasteSpecial value

thank you Gary & Chip;

following code worked for me;
vSourceWS.Range("N500:W" & vSourceLastRow + 1).Copy
vTargetWS.Range("F" & vTargetLastRow + 1).PasteSpecial Paste:=xlPasteValues


"Atif" wrote:

Here are two example of Code. Trying to copy Range of cells from SourceWS to
TargetWS.

This code working fine, as I have formula at Source its copy Formul.
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy vTargetWS.Range("F"
& vTargetLastRow)

I tried to use PasteSpecial in result receiving Syntex Error
vSourceWS.Range("N" & vSourceLastRow).CurrentRegion.Copy _
vTargetWS.Range("F" & vTargetLastRow).PasteSpecial Paste:=xlPasteValues

Whats worng!

Regards
Atif

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
Why need to use Selection.PasteSpecial vs myRange.PasteSpecial [email protected] Excel Programming 4 June 25th 07 05:34 PM
Help with PasteSpecial [email protected] Excel Programming 2 June 9th 06 11:35 AM
PasteSpecial Kevin Excel Programming 3 October 7th 04 01:07 PM
pastespecial Jeff Excel Programming 4 September 28th 04 10:30 PM
pastespecial billQ Excel Programming 2 July 29th 03 11:39 PM


All times are GMT +1. The time now is 03:50 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"