I'm no VBA expert but I believe that the code is blowing up because Sheet
Feb06 is not the active sheet. To cointinue using your code change it to:
Sheets("JAN06").Select
Range("C4:CR54").Select
Selection.ClearContents
Range("A4:AG60").Select
Selection.Copy
Sheets("3 Months").Range("A4:AG60").PasteSpecial
Paste:=xlPasteValues
Sheets("Feb06").Select
Range("F4:AG60").Select
Selection.Copy
Sheets("3 Months").Range("AH4:BI60").PasteSpecial
Paste:=xlPasteValues
Sheets("Mar06").Select
Selection.Copy
Sheets("3 Months").Range("BJ4:CN60").PasteSpecial
Paste:=xlPasteValues
However, you do not need to select anything to copy and paste it. Here is
our code re-written to avaid selecting:
Sub NewCode()
Application.ScreenUpdating = False
With Sheets("JAN06")
.Range("C4:CR54").ClearContents
.Range("A4:AG60").Copy
With Sheets("3 Months")
.Range("A4").PasteSpecial Paste:=xlPasteValues
End With
End With
With Sheets("Feb06")
.Range("F4:AG60").Copy
With Sheets("3 Months")
.Range("AH4").PasteSpecial Paste:=xlPasteValues
End With
End With
With Sheets("Mar06")
.Range("F4:AJ60").Copy
With Sheets("3 Months")
.Range("BJ4").PasteSpecial Paste:=xlPasteValues
End With
End With
Application.CutCopyMode = False
applciation.ScreenUpdating = True
End Sub
Sandy
with @tiscali.co.uk
"Naji" wrote in message
ups.com...
Hi,
I am getting this error:
Select Method of Range Class Failed
When I run my macro that copies a selected range from one worksheet to
another. The worksheet it is copying from has values that are linked to
another workbook. My code is as follows:
Range("C4:CR54").Select
Selection.ClearContents
Sheets("JAN06").Range("A4:AG60").Select
Sheets("Jan06").Range("A4:AG60").Copy
Sheets("3 Months").Range("A4:AG60").PasteSpecial
Paste:=xlPasteValues
Sheets("Feb06").Range("F4:AG60").Select
Sheets("Feb06").Range("F4:AG60").Copy
Sheets("3 Months").Range("AH4:BI60").PasteSpecial
Paste:=xlPasteValues
Sheets("Mar06").Range("F4:AJ60").Select
Sheets("Mar06").Range("F4:AJ60").Copy
Sheets("3 Months").Range("BJ4:CN60").PasteSpecial
Paste:=xlPasteValues
The ranges clearly exist and so do the workbooks yet it gives me that
error. Why is this?