PasteSpecial method of Range class failed

Reddog94

Board Regular
Joined
Dec 20, 2011
Messages
52
I've been reading like posts on mrexcel.com for an hour - but still cannot fix my problem.

I have what I think should be a pretty basic code to copy visible cells in one sheet, then paste values in the next sheet. I continue to get a run-time 1004 "PasteSpecial method of Range class failed". When the code runs in the document, I see the paste range (A1) highlighted, but then it bombs.

Code:
On Error Resume Next
 
With Range("EMPLOYEE_VISIBLE_RANGE").CurrentRegion
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(12).Copy
End With
Err.Clear
 
ActiveWorkbook.Sheets("Sheet3").Range("A1").PasteSpecial xlPasteValues

Does anybody see what I'm doing wrong?

Thank you.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
How many rows are in the range you are copying?
 
Upvote 0
It's variable, based on a pull from a database query. If I had to copy paste a static number, 250 would probably do it.
 
Upvote 0
What happens when you remove this?
Code:
On Error Resume Next
Do you get an error elsewhere in the code?
 
Upvote 0
Is the destination sheet protected?
 
Upvote 0
No, there isn't any protection in the workbook yet. In fact, I'm just using a blank sheet to test first. Once I figure out the code, then I will get it to paste in the proper tab.
 
Upvote 0
It works fine for me.

What address appears in the message box with this code.
Code:
Dim rng As Range
 
    With Range("EMPLOYEE_VISIBLE_RANGE").CurrentRegion
        Set rng = .Offset(1).Resize(.Rows.Count - 1).SpecialCells(12)
    End With
 
    MsgBox rng.Address
 
    ActiveWorkbook.Sheets("Sheet3").Range("A1").PasteSpecial xlPasteValue

PS Just out of curiosity why are you using SpecialCells? Has the data been filtered?
 
Upvote 0
Sorry I'm confused, that was the message?
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top