I currently have an excel file that is sorted via a v lookup which compares a part lists on a sheet to a separate master sheet in the same file, and if ALL the parts are not on the master sheet, the WHOLE part sheet should be deleted. I currently have a for each row within a for each sheet, that if my vlookup row is blank it should delete the sheet, but it is not deleting any sheet. Any recommendations?
What you can do is inside for each sheet…use a read range and read the data into datatable dt1
Also read the master file data into dt
Now use this in if condition dt1.AsEnumerable.All(function(x) dt.AsEnumerable.Any(function(y) y("PartColumnMastersheet").ToString.Equals(x("PartColumn").ToString)))
On then side all parts are present and on else side atleast one is missing…so save the sheetnames or directly use delete sheet