修改
Option Explicit
Dim ParentArr : ParentArr = Array("47266943","UPDATE/ENABLE SUPPLIER ADDRESS - Water","F48471101","ASHLAND INDUSTRIES EUROPE GMBH","Tier 4 Review","Bihacker, Zoltán Árpád",
"9/4/12 3:34 AM","9/25/12 3:06 PM","Closed",
"Water and Process Technologies/Direct - Chemicals/Europe - United Arab Emirates","47266943",
"Return to Requestor (Update/Enable WF) - Water","09/04/2012 04:59:36 AM","Bihacker, Zoltán Árpád","Bihacker, Zoltán Árpád",
"Return to Requestor (Update/Enable WF) - Water","09/06/2012 08:29:34 AM","Bihacker, Zoltán Árpád","Bihacker, Zoltán Árpád",
"Requestor Provides Business Specific Supplier Details - Update/Enable Supplier","09/04/2012 03:34:32 AM","Bihacker, Zoltán Árpád","Bihacker, Zoltán Árpád",
"Requestor Provides Supplier Details - Update/Enable Supplier","09/04/2012 03:40:22 AM","Bihacker, Zoltán Árpád",
"Bihacker, Zoltán Árpád","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","09/11/2012 01:43:53 AM",
"Karve, Vinod","Karve, Vinod","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","09/04/2012 04:59:36 AM",
"Karve, Vinod","Karve, Vinod","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","09/06/2012 08:29:34 AM",
"Karve, Vinod","Karve, Vinod","Sourcing Final Review of Supplier Self-Serve - Update/Enable Supplier","09/17/2012 08:59:36 AM",
"Karve, Vinod","Karve, Vinod","Sourcing Final Review of Supplier Self-Serve - Update/Enable Supplier","09/19/2012 08:29:34 AM","Karve, Vinod",
"Karve, Vinod","Sourcing Final Review of Requestor Provided Details - Update/Enable Supplier","09/11/2012 04:52:28 PM","Vekemans, Ilse",
"Vekemans, Ilse","Sourcing Final Review of Requestor Provided Details - Update/Enable Supplier","09/18/2012 08:59:36 AM","Karve, Vinod",
"Karve, Vinod","Sourcing Final Review of Requestor Provided Details - Update/Enable Supplier","09/20/2012 08:29:34 AM","Karve, Vinod",
"Karve, Vinod","Resend Supplier Survey - Update/Enable Supplier","09/26/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Resend Supplier Survey - Update/Enable Supplier","09/24/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod",
"Supplier Starts Survey - Update/Enable Supplier","09/25/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod",
"Supplier Starts Survey - Update/Enable Supplier","09/27/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Supplier Completes Survey - Update/Enable Supplier","11/08/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Supplier Completes Survey - Update/Enable Supplier","11/06/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod",
"VMH All Fields Review of Supplier Survey - Update/Enable Supplier","1/07/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod",
"VMH All Fields Review of Supplier Survey - Update/Enable Supplier","11/09/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Sourcing Review of Supplier Survey - Update/Enable Supplier","11/13/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod",
"Sourcing Review of Supplier Survey - Update/Enable Supplier","11/15/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Sourcing Quality Review of Supplier Survey - Update/Enable Supplier","11/14/2012 08:59:36 AM","Karve, Vinod",
"Sourcing Quality Review of Supplier Survey - Update/Enable Supplier","09/12/2012 02:41:01 AM","Schreurs, Rene","Schreurs, Rene",
"Sourcing Quality Review of Supplier Survey - Update/Enable Supplier","11/16/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Finance Review of Supplier Survey - Update/Enable Supplier","09/21/2012 08:30:17 AM","Bruck, Barbara","Bruck, Barbara",
"Finance Review of Supplier Survey - Update/Enable Supplier","11/15/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod",
"Finance Review of Supplier Survey - Update/Enable Supplier","11/19/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Activate / Create supplier in business system - Update/Enable Supplier","11/16/2012 08:59:36 AM","Karve, Vinod","Karve, Vinod",
"Activate / Create supplier in business system - Update/Enable Supplier","11/20/2012 08:29:34 AM","Karve, Vinod","Karve, Vinod",
"Activate / Create supplier in business system - Update/Enable Supplier","09/24/2012 04:01:28 AM","Goud, Siddhartha","Goud, Siddhartha")
Dim VMHArray : VMHArray = Array("VMH All Fields Review - Add Supplier Emergency","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","VMH Triggered Final Sourcing Review - Add Address_Direct","Activate / Create supplier in business system - Add Address","Activate / Create supplier in Business System - Add Supplier","Activate / Create supplier in Business System - Add Supplier Emergency","Activate / Create supplier in business system - Update/Enable Supplier","Resend Supplier Survey - Add Address","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Update/Enable Supplier","SSS BTP Team – Add Address","SSS BTP Team – Update/Enable Supplier","SSS BTP Team E","SSS BTP Team S","SSS BTP Team-Update/Activate Supplier ","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","VMH All Fields Review - Add Address","VMH All Fields Review - Add Supplier","VMH All Fields Review - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Add Address","VMH All Fields Review of Supplier Survey - Add Supplier","VMH All Fields Review of Supplier Survey - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Update/Enable Supplier","VMH Bank Review - Edit Supplier/Address_Direct","VMH Bank Review - Push To Downstream","VMH Edit Supplier/Address_Direct","VMH Inputs Supplier Details - Add Address_Direct","VMH Inputs Supplier Details - Add Supplier_Direct","\VMH Triggered Final Sourcing Review - Add Address_Direct","Activate / Create supplier in business system - Add Address","Activate / Create supplier in Business System - Add Supplier","Activate / Create supplier in Business System - Add Supplier Emergency","Activate / Create supplier in business system - Update/Enable Supplier","Resend Supplier Survey - Add Address","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Add Supplier","Resend Supplier Survey - Update/Enable Supplier","SSS BTP Team – Add Address","SSS BTP Team – Update/Enable Supplier","SSS BTP Team E","SSS BTP Team S","SSS BTP Team-Update/Activate Supplier ","VMH All Fields Review (Req. Provides Supplier Details) - Update/Enable Supplier","VMH All Fields Review - Add Address","VMH All Fields Review - Add Supplier","VMH All Fields Review - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Add Address","VMH All Fields Review of Supplier Survey - Add Supplier","VMH All Fields Review of Supplier Survey - Add Supplier Emergency","VMH All Fields Review of Supplier Survey - Update/Enable Supplier","VMH Bank Review - Edit Supplier/Address_Direct","VMH Bank Review - Push To Downstream","VMH Edit Supplier/Address_Direct","VMH Inputs Supplier Details - Add Address_Direct","VMH Inputs Supplier Details - Add Supplier_Direct","VMH Supplier Validation - Add Address","VMH Supplier Validation - Add Supplier","VMH Supplier Validation - Update/Enable Supplier","VMH Triggered Final Sourcing Review - Edit Supplier/Address_Direct","VMH Watchlist Review - Add Address","VMH Watchlist Review - Add Address_Direct","VMH Watchlist Review - Add Supplier","VMH Watchlist Review - Add Supplier_Direct","VMH Supplier Validation - Add Supplier","VMH Supplier Validation - Update/Enable Supplier","VMH Triggered Final Sourcing Review - Edit Supplier/Address_Direct","VMH Watchlist Review - Add Address","VMH Watchlist Review - Add Address_Direct","VMH Watchlist Review - Add Supplier","VMH Watchlist Review - Add Supplier_Direct")
Dim i,IndexSearch
Dim ArrayListTaskDetails : Set ArrayListTaskDetails = CreateObject("System.Collections.ArrayList")
For i=Lbound(ParentArr) To Ubound(ParentArr)
ArrayListTaskDetails.Add(ParentArr(i))
Next
For IndexSearch = Lbound(VMHArray) To Ubound(VMHArray)
Do Until ArrayListTaskDetails.IndexOf(VMHArray(IndexSearch), 0) = -1
RemovePosition = ArrayListTaskDetails.IndexOf(VMHArray(IndexSearch), 0)
'MsgBox(RemovePosition)
ArrayListTaskDetails.RemoveRange RemovePosition, 4
Loop
Next
答案 0 :(得分:1)
从输出中可以看出:
alSrc: a.x.x.x.b.c.d.e.x.x.x.f.a.x.x.x.
aRmv: a.e.i
a 0 a.x.x.x.b.c.d.e.x.x.x.f.a.x.x.x.
a 8 b.c.d.e.x.x.x.f.a.x.x.x.
a -1 b.c.d.e.x.x.x.f.
e 3 b.c.d.e.x.x.x.f.
e -1 b.c.d.f.
i -1 b.c.d.f.
alSrc: b.c.d.f.
这个演示脚本:
Dim alSrc : Set alSrc = CreateObject("System.Collections.ArrayList")
Dim sE
For Each sE In Split("a x x x b c d e x x x f a x x x ")
alSrc.Add sE
Next
WScript.Echo "alSrc:", Join(alSrc.ToArray(), ".")
Dim aRmv : aRmv = Split("a e i")
WScript.Echo "aRmv:", Join(aRmv, ".")
Dim nI
For Each sE In aRmv
Do
nI = alSrc.IndexOf(sE, 0)
WScript.Echo sE, nI, Join(alSrc.ToArray(), ".")
If -1 < nI Then alSrc.RemoveRange nI, 4
Loop Until -1 = nI
Next
WScript.Echo "alSrc:", Join(alSrc.ToArray(), ".")
您可以可靠地删除针(a,e)的所有范围,然后从ArrayList中删除另外三个元素(x x x)。
只要你没有提供预期结果与实际结果的详细说明,所有我都可以说:罪魁祸首必须是您的代码或数据(即你)。