Runtime Error 1004

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,208
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:

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Kamolga

Well-known Member
Joined
Jan 28, 2015
Messages
1,176
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,587
Messages
5,597,034
Members
414,116
Latest member
sfullnet

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
Top