VBA Advanced Filter clearing cells out of it's range

GlennL

New Member
Joined
Sep 25, 2018
Messages
33
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello,

I am using an advance filter in VBA.

Step 1 I do a row count using xlFilterInPlace of the advanced filter
Step 2 I make the CopyToRange the same size as the xlFilterinPlace row count
Step 3 I run the advanced filter using xlFilterCopy

The problem I am having is, the cells under the CopyToRange are getting the cell values cleared.
I have tried putting these cells 1000 rows lower on the sheet, but the same thing occurs.

Anyone have come across this before and have a solution?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Click on Copy to another Location.
in Copy To select a new range for filtered output. single row with same number of columns will do.
 
Upvote 0
Hello,

I am using an advance filter in VBA.

Step 1 I do a row count using xlFilterInPlace of the advanced filter
Step 2 I make the CopyToRange the same size as the xlFilterinPlace row count
Step 3 I run the advanced filter using xlFilterCopy

The problem I am having is, the cells under the CopyToRange are getting the cell values cleared.
I have tried putting these cells 1000 rows lower on the sheet, but the same thing occurs.

Anyone have come across this before and have a solution?
Problem found, CopyToRange was set wrong
 
Upvote 0
Solution

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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