Hello VBA Wizards,
Would like to request for your assistance again to solve another VBA problem. I'm sure you have a solution for this, but would like to ask for your guidance on this.
PROBLEM:
I'm creating a macro which will filter 4 criteria(not necessary true for all 4) on 10 excel workbooks and copy the filtered contents on a separate workbook.
As seen from above there are four criteria namely: INDUSTRIES, SPEEDY, ELECTRONICS, WORLD. But the problem is, NOT all Excel Workbooks have all 4 criteria. Possible that on the 1st workbook I will only have INDUSTRIES and WORLD, 2nd workbook will only have INDUSTRIES and SPEEDY while 3rd workbook contains ELECTRONICS and WORLD. The code above would simply result to error if one workbook does not contain either one of the criteria.
Ultimately, is there a way to handle such case with If error?
I am thinking of doing a "scan" of the column first and see if the criteria are there or not and run a if code after that.
Any guidance would be greatly appreciated!
Thank you so much!
Would like to request for your assistance again to solve another VBA problem. I'm sure you have a solution for this, but would like to ask for your guidance on this.
PROBLEM:
I'm creating a macro which will filter 4 criteria(not necessary true for all 4) on 10 excel workbooks and copy the filtered contents on a separate workbook.
Code:
ActiveSheet.Range("A1:W" & LastRow).AutoFilter Field:=9, Criteria1:=Array("INDUSTRIES", "SPEEDY", "ELECTRONICS", "WORLD"), Operator:=xlFilterValues
As seen from above there are four criteria namely: INDUSTRIES, SPEEDY, ELECTRONICS, WORLD. But the problem is, NOT all Excel Workbooks have all 4 criteria. Possible that on the 1st workbook I will only have INDUSTRIES and WORLD, 2nd workbook will only have INDUSTRIES and SPEEDY while 3rd workbook contains ELECTRONICS and WORLD. The code above would simply result to error if one workbook does not contain either one of the criteria.
Ultimately, is there a way to handle such case with If error?
I am thinking of doing a "scan" of the column first and see if the criteria are there or not and run a if code after that.
Any guidance would be greatly appreciated!
Thank you so much!