merlynsdad
Programmer
I'm modifying a program I wrote about a year ago, which ran perfectly then. Now, at a certain point, it is giving the error "A formula or sheet you want to move or copy contains the name 'NAMES' which already exists in the destination worksheet." I don't know where this is coming from, and there are no range "names" in the destination worksheet, which is the program running the code. The program is moving data from one spreadsheet to another, and the code leading up to the error is as follows:
ws.Activate
ws.Range("$E$6").Activate
Selection.AutoFilter
Selection.AutoFilter Field:=5, Criteria1:=lstText
'Copy the query results to the Query tab in this workbook
ActiveSheet.Cells.Select
Selection.Copy
ActiveSheet.Range("a1").End(xlDown).Offset(1, 0).Select
Set rng = ActiveSheet.AutoFilter.Range
Me.Activate
ActiveWorkbook.Sheets("QueryEmp").Select
'The next line will generate an error message; press YES and continue.
rng.Resize(rng.Rows.Count).Copy Destination:=Range("$a$16")
Where is this coming from, and how do I get rid of it? Thanks in advance.
ws.Activate
ws.Range("$E$6").Activate
Selection.AutoFilter
Selection.AutoFilter Field:=5, Criteria1:=lstText
'Copy the query results to the Query tab in this workbook
ActiveSheet.Cells.Select
Selection.Copy
ActiveSheet.Range("a1").End(xlDown).Offset(1, 0).Select
Set rng = ActiveSheet.AutoFilter.Range
Me.Activate
ActiveWorkbook.Sheets("QueryEmp").Select
'The next line will generate an error message; press YES and continue.
rng.Resize(rng.Rows.Count).Copy Destination:=Range("$a$16")
Where is this coming from, and how do I get rid of it? Thanks in advance.