Hi am geting an error 1004 when i try to copy filtered rows?

zabiullakhan

Active Member
Joined
Aug 30, 2010
Messages
310
Hi am geting an error when i try to copy the visable rows only however i get an error 1004 on line marked red.. please help
Code:
For Col = 1 To LastColumn
        Value = Cells(1, Col).Value
        If InaCols.Exists(Value) Then
            Cells(2, Col).Select
            Range(Selection, Selection.Offset(LastInfoRow, 0)).Select
[COLOR=red]            Selection.SpecialCells(xlCellTypeVisible).Copy
[/COLOR]            'Selection.Copy
            InaData.Cells(6, InaCols(Value)).PasteSpecial xlValue
            Application.CutCopyMode = False
        End If
    Next
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Range(Selection, Selection.Offset(LastInfoRow, 0)).Select
Selection.SpecialCells(xlCellTypeVisible).Copy
'Selection.Copy
Try:
Code:
            Range(Selection, Selection.Offset(LastInfoRow, 0)).Select
            Selection.SpecialCells(xlCellTypeVisible).Select
            Selection.Copy
Yes, it seems an odd way to get there but it works in Excel 2010
 
Upvote 0
Hi

We need more information as to the area being filtered.

Why you are using a reserved word "Value" as a variable?

What does InaCols do?
 
Upvote 0
Hi all,
InaCols - value stores the value of the header where it has to paste the data

am not sure about the reserved word "Value" as a variable can you please elobrate on it

Thanks..
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

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