Advanced Filter Deleting cells below CopyToRange

JohnnyPicnic

New Member
Joined
Feb 8, 2021
Messages
17
Office Version
  1. 2019
Platform
  1. Windows
I have an Advanced Filter grabbing data from a table on another sheet.
I can't seem to place the new filtered data above previously formatted cells. It deletes anything below it. Or complains if there is a merged cell below.
The macro to run the advance filter is"
VBA Code:
Sub Assets()
'
' Assets Macro
'

'
    Sheets("Assets").Range("Assets[#All]").AdvancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Range("H5:H6"), CopyToRange:=Range("A16:F16"), Unique:= _
        False
End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
That will change the format of the cells to match the original table, but it should not change the cell format for any rows that are below the copied data.
 
Upvote 0
Is there a way to insert the copied data without it formatting the cells below? The original table has over 400 rows, the new copied data is variable but usually 4-5 rows.
 
Upvote 0
It shouldn't format cells below the copied data, only those cells where the data has been copied to.
 
Upvote 0
I'm must be missing something. Here are some screen shots of before and after running the VBA macro.
2022-01-06_13-01-28.png
 

Attachments

  • 2022-01-06_13-01-50.png
    2022-01-06_13-01-50.png
    14.5 KB · Views: 8
Upvote 0
That is not cell formatting, that is data, which will get removed.
 
Upvote 0
There shouldn't be any. I seem to have a temporary fix by setting the CopyToRange:=Range("A16:F25") instead of CopyToRange:=Range("A16:F16")
 
Upvote 0
You obviously saw my post before I edited it. Have another look.
 
Upvote 0
So when I do have more copied data it gives me a warning. When I only have one or two rows it still deletes everything below without warning.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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