object required error

teatimecrumpet

Active Member
Joined
Jun 23, 2010
Messages
307
Hi,

I'm trying to run the below code but it fails a the highlighted line because of "object required". But that line seems to run alright because it does copy all the visible cells excluding the header.

thanks,

Sub fRS()
Dim RNG As Range
Set RNG = ActiveSheet.Range("A1").CurrentRegion
RNG.AutoFilter Field:=6, Criteria1:="Yellow"

RNG.AutoFilter Field:=12, Criteria1:=Array( _
"Mike", _
"John", _
"George", _
"Phyllis", _
"Rebecca", _
"Sarah", _
"Calvin", _
"Dylan", _
"Steve", _
"Marvin"), Operator:=xlFilterValues

'exclude header
Set RNG = RNG.Offset(1, 0).Resize(RNG.Rows.Count - 1)
' Get visible cells
Set RNG = RNG.SpecialCells(xlCellTypeVisible).Copy
'Selection.Copy
Windows("Sawyer.xlsx").Activate
Sheets(1).Activate
Range("A1048576").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
The syntax of your highlighted line is incorrect. You can change that part of the code to:
Code:
'exclude header
Set RNG = RNG.Offset(1, 0).Resize(RNG.Rows.Count - 1)
' Get visible cells
RNG.Copy
Windows("Sawyer.xlsx").Activate
Sheets(1).select
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
Activesheet.Paste
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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