0

I am using the solution from this post to autofilter a table and paste the selected columns to another sheet.

It is doing exactly what I want it to do with one exception. I am copying from a table that uses filtered drop down menus. As a result, the following message pops up while copying: The name already exists

The solution offered in this blog is not an option as the source table is dependent on the named values in it.

Is there an additional statement I can add to the below code that will make it paste special?

  copyRange4.SpecialCells(xlCellTypeVisible).Copy tgt.Range("E10")

If not, can something be added to select "Yes" without the pop up appearing at all?

Finally, after it pastes to my target, can an additional line be added to unfilter the source?

urdearboy
  • 14,439
  • 5
  • 28
  • 58
DHGS11
  • 3
  • 2

1 Answers1

0

Disable Alert to by-pass the alert,

Application.DisplayAlerts = False
    copyRange4.SpecialCells(xlCellTypeVisible).Copy tgt.Range("E10")
Application.DisplayAlerts = True

To unfilter,

If (Range).AutoFilterMode Then
    (Range).ShowAllData
End If

Where (Range) is your range with filter.

urdearboy
  • 14,439
  • 5
  • 28
  • 58