Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
PasteSpecial Method Error | Excel Discussion (Misc queries) | |||
PasteSpecial method of Range class failed | Excel Programming | |||
How to use Object.Copy(Destination) method PasteSpecial(xlPasteVal | Excel Programming | |||
Run-time error '1004' PasteSpecial Method of Range Class Failed | Excel Programming | |||
Making VB PasteSpecial method to work the same as Excels Application | Excel Programming |