Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Help - PasteSpecial Method - Not Working

Hello,

I am running some VBA code (Below) and am trying to utilize the PasteSpecial
Method, but am receiving an error message. The worksheet that I am copying
contains links to other sheets. I want to use the PasteSpecial method to
only bring in the values.

Any help would be much appreciated.


Error Message:
"PasteSpecial Method of worksheet class failed"

Code:
With wbOriginal
With .Worksheets("Overall - by Market")
.Select
.Range(db.CompleteRange).NumberFormat = "General"
.Range(db.CompleteRange).Copy
End With
.Saved = True
End With

Set wbNew = XLS.Workbooks.Add

With wbNew.Worksheets("Sheet1")
.Select
.PasteSpecial xlValues
End With


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Help - PasteSpecial Method - Not Working

i was more or less just showing you didn't need all of the select code. this
may do exactly the same as your code.

Sub test()
Worksheets.Add.Name = "sheet1"
With Worksheets("sheet1").Range("A1")
Worksheets("Overall - by Market").Range("CompleteRange").Copy
..PasteSpecial xlValues
..NumberFormat = "general"
End With
End Sub

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i don't know your layout, but his is all you need to copy and paste a
range. maybe you can adapt your code using this. this would copy a range
called CompleteRange from sheet4 to sheet1 starting in A1.


With Worksheets("Sheet1").Range("a1")
Worksheets("sheet4").Range("CompleteRange").Copy
.PasteSpecial xlValues
End With

--


Gary


"ACase" wrote in message
...
Hello,

I am running some VBA code (Below) and am trying to utilize the
PasteSpecial
Method, but am receiving an error message. The worksheet that I am
copying
contains links to other sheets. I want to use the PasteSpecial method to
only bring in the values.

Any help would be much appreciated.


Error Message:
"PasteSpecial Method of worksheet class failed"

Code:
With wbOriginal
With .Worksheets("Overall - by Market")
.Select
.Range(db.CompleteRange).NumberFormat = "General"
.Range(db.CompleteRange).Copy
End With
.Saved = True
End With

Set wbNew = XLS.Workbooks.Add

With wbNew.Worksheets("Sheet1")
.Select
.PasteSpecial xlValues
End With






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 Method Error PW11111 Excel Discussion (Misc queries) 1 December 19th 06 01:24 PM
PasteSpecial method of Range class failed windsor Excel Programming 6 October 6th 05 10:16 PM
How to use Object.Copy(Destination) method PasteSpecial(xlPasteVal RAP Excel Programming 1 August 16th 05 03:58 PM
Run-time error '1004' PasteSpecial Method of Range Class Failed Kevin G[_2_] Excel Programming 1 February 3rd 04 05:01 AM
Making VB PasteSpecial method to work the same as Excels Application John[_35_] Excel Programming 1 July 10th 03 05:20 PM


All times are GMT +1. The time now is 04:41 AM.

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"