Error 91excel vba

0

I have developed a macro excel in the book "A", I execute it calling it from another book the "B". In the book "B" I copy an excel sheet "data" that is generated in an Excel export process of a book "C" that contains the "data" sheet. If in the book "B" I create a new sheet called "data" and I copy in this sheet the cells of the data sheet of the book "C", the macro works well. However, if I copy the sheet "data" from the book "C" to the book "B" and execute the macro, the message appears

  

Error 91 occurred at run time: Object variable   or block with not established

And the macro stops in the instruction

Worksheets("AVEVACons").AutoFilter.Sort.SortFields.Clear

Any suggestions? Thanks

    
asked by Javier 26.06.2018 в 22:27
source

1 answer

0

As I understand it, the macro is created in the book where you have the original sheet "AVEVAcons", try with:

Thisworkbook.Sheets("AVEVACons").AutoFilter.Sort.SortFields.Clear
    
answered by 04.10.2018 в 22:22