View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Error in PasteSpecial ?

will this do what you want?

Sub TimeSheets()
Sheets("AAA").Range("A1:U41").Insert
With ActiveWorkbook.Sheets("ZZZ")
.Select
.Range("a1:u41").Copy
Sheets("AAA").Range("A1:U42").PasteSpecial Paste:=xlPasteValues
Sheets("AAA").Range("A1:U42").PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End With
End Sub

--


Gary


"Corey" wrote in message
...
=====================================
Sub TimeSheets()
Sheets("AAA").Range("A1:U41").Insert
With ActiveWorkbook
Sheets("ZZZ").Select
End With
With activeworksheet
Range("a1:u41").Copy
Sheets("AAA").Select
'Worksheets("AAA").Range("A1:U42").PasteSpecial Paste:=xlPasteValues
Range("A1").PasteSpecial <============== ERROR
End With
End Sub
=====================================

I am using the above code to copy and paste values froM another worksheet.
I WANT THE FORMAT AND VALUES COPIED, which the abovew does, however,
I get a "Method of 'PasteSpecial' of Object 'Range' Failed error".
If i click end ALL is fine, how can i rid the code of the error alert?


Corey