Runtime Error 1004

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all

I am getting an error on the code below highlited Bold

Runtime Error 1004 "This selection isn't valid. Make sure the copy and paste area's don't overlap unless they are the same size and shape"

I am copying an active Row but then Transposing to column "B1"

I know the issue is copy Rows to a Column as the size is different but any idea's please on how to fixed this or even improve the code


Code:
Sub PopulateGRV()
Sheets("Submission").Visible = True
Sheets("GRV").Visible = True
On Error GoTo DuplicatedReference
Application.ScreenUpdating = False
'POPULATE THE TEMPLATE
    Rows(ActiveCell.Row).Copy
    Sheets("Submission").Select
    Range("B1").Select
   [B] Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True[/B]
        
    Application.CutCopyMode = False
   Application.DisplayAlerts = False
   
    Sheets("GRV").Select
    
    Worksheets("GRV").Copy After:=Worksheets(Worksheets.Count)
 
Last edited:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You have to make sure your active cell is not already on that sheet (pasted transpose can not cross the copied area) and no pivot in the way. If you want to take 100 columns instead of the entire row, you can use
Code:
Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 100)).Copy
but if I copy a row transpose it in a new sheet it works

Code:
Rows("4:4").Copy    Sheets.Add After:=ActiveSheet
    Range("B1").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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