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

Hi
This line of code brings up a "Compile error" - "Expected: end of statement"
with Paste highlighted,
what end of statement is it expecting i think I've tried them all.

ActiveCell.Offset(-4, -1).Resize(1, 29).Copy Destination:=ActiveCell.Offset _
(-4, -1).PasteSpecial Paste:=xlPasteValuesAndNumberFormats

From previous posts I've read it appears it's best to split these into 2
lines or place in a "With - End With.
Any advice very much appreciated.
I'm trying to tidy up my code and clear formulas not required three rows
back as I add new data to the sheet.
--
Thank you

Regards

Bob C
Using Windows XP Home + Office 2003 Pro
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default PasteSpecial error

In the copy command you can not use PasteSpecial.
So the complier is expecting end of satement before the .PasteSpecial
part of your code.

You need to break it in to two lines as under:

ActiveCell.Offset(-4, -1).Resize(1, 29).Copy
ActiveCell.Offset(-4, -1).PasteSpecial xlPasteValuesAndNumberFormats

Sharad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default PasteSpecial error

Thank you Sharad
Your comments comfirmed what I was slowly finding out.
Copy, Destination and Pastespecial don't go together in one line.

Seasons greatings and have a happy New Year 2005.

Regards
Bob C.

"Sharad" wrote:

In the copy command you can not use PasteSpecial.
So the complier is expecting end of satement before the .PasteSpecial
part of your code.

You need to break it in to two lines as under:

ActiveCell.Offset(-4, -1).Resize(1, 29).Copy
ActiveCell.Offset(-4, -1).PasteSpecial xlPasteValuesAndNumberFormats

Sharad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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
PasteSpecial Error 1004? DaveM Excel Discussion (Misc queries) 3 February 7th 08 02:41 PM
PasteSpecial Method Error PW11111 Excel Discussion (Misc queries) 1 December 19th 06 01:24 PM
Runtime Error 1004 when trying to PasteSpecial Phil Davis Excel Discussion (Misc queries) 2 February 16th 06 10:02 PM
PasteSpecial Error sowetoddid[_14_] Excel Programming 3 April 28th 04 12:14 AM
Run-time error '1004' PasteSpecial Method of Range Class Failed Kevin G[_2_] Excel Programming 1 February 3rd 04 05:01 AM


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