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 |
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 |
All times are GMT +1. The time now is 06:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com