PasteSpecial method of Range class failed

Dobin1s

New Member
Joined
May 18, 2016
Messages
8
Hi im trying to run a bit of code thats always worked fine before and has not been recently changed however now im getting this error "PasteSpecial method of Range class failed" when getting to the line in red below

Selection.EntireRow.Hidden = False 'unhidden
Range("A" & MOVEROW).EntireRow.Select 'select whole row to move
Range("A" & MOVEROW).EntireRow.Copy 'copy whole row to move
Sheets(3).Select
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData 'show all
Range("A65536").End(xlUp).Offset(1, 0).Select 'goes to bottom of spreadsheet and then shift end up
If ActiveCell.Row = 2 Then Selection.Offset(1, 0).Select 'stop info going in row 2
TOLINE = ActiveCell.Row 'defines line pasting info to
Range("A" & TOLINE).Select 'selects bottom row on TO sheet
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats

Im a little confused because the code hasnt been changed since it was last run so im not sure if there is anything wrong at all...


Thanks in advance
 
No it was failing (well highlighting) on


Sheets(3).Range("A65536").End(xlUp).Offset(1, 0).Select

Try changing that line to this:
Code:
Sheets(3).Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You need to be on Sheet 3 first before you can activate a cell on it (I am guessing that the ActiveCell is on a different sheet when this code is trying to run, and that is what is causing the issue).

Try:
Code:
[COLOR=#333333]Sheets(3).Activate
Range("A65536").End(xlUp).Offset(1, 0).Select[/COLOR]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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