ListObjects Autofilter will works properly in debug mode only

Viewed 91

Story: Have 1 macro as main, which runs 4 others in defined order. each of them works properly when I run them separatedly. Problem I am facing is Listobjects.autofilter - which gave me as a result zero lines, but in debug mode I can see correct output.

Filter is set on column containing formulas:

=IFERROR([@[Company Code]]&"_"&[@Account]&"_"&IF(ISERROR([@[UTR Bank Code]]),[@[FCHN Check Number]],[@[UTR Bank Code]]),"DEL")

Code for autofilter:

Sheets("SAP_BankST").ListObjects("SAP_BankST").AutoFilter.ShowAllData '.AutoFilter.ShowAllData
Sheets("SAP_BankST").ListObjects("SAP_BankST").DataBodyRange.AutoFilter field:=1, Criteria1:="<>" & "DEL"
  • doesn't matter if I will set criteria to be "<>DEL" or "<>DEL" or even tested for only "DEL"
  • in all cases, filter is set, but output is nothing even that there are rows

I tried application.wait before, doevents before, check if autofilter on, remove autofilter before - nothing help. This part was executed while executing SAP GUI script to retrieve input for SAP t-code - not working, move to end of previous process, where data are downloaded from SAP - not working, SAP connection set = nothing before this autofilter should be applied - not working.

You can see that there is something to be filtered.

enter image description here

0 Answers
Related