我有CSV文件,我转换为excel文件,有两个选项卡,每个选项卡都有一列邮政编码。该属性我想看看属性邮政编码是否在属性邮政编码列表中的任何位置。属性邮政编码位于属性选项卡的各个单元格中的逗号分隔列表中。
我到了那里,但是我崩溃了系统。谁能告诉我为什么?
这是我的代码:
Sub propZips()
Dim wsProperty As Worksheet: Set wsProperty = Worksheets("propertyOutput.csv")
Dim zipColumnProperty As Integer: zipColumnProperty = 2
Dim propertyRows As Integer: propertyRows = wsProperty.Cells(Rows.Count, 1).End(xlUp).Row - 1 ' less 1 for label row
Dim singlePropZip As String
' vendor variables
Dim wsVendor As Worksheet: Set wsVendor = Worksheets("vendorOutput.csv")
Dim zipColumnVendor As Integer: zipColumnVendor = 5
Dim vendorRows As Integer: vendorRows = wsVendor.Cells(Rows.Count, 1).End(xlUp).Row - 1 ' less 1 for label row
' counter variables
Dim propCounter As Integer ' for loop through property zips
Dim venCounter As Integer ' for loop through vendors
Dim tempServArea() As String ' array to hold an individul vendor's service area
Dim subArrayCounter As Integer
For propCounter = 1 To propertyRows ' loop through properties
singlePropZip = wsProperty.Cells(propCounter + 1, zipColumnProperty) ' propety zip in question
For venCounter = 1 To vendorRows ' loop through vendor service areas
tempServArea = Split(wsVendor.Cells(venCounter + 1, zipColumnVendor), ",") ' load temp array with split reults
For subArrayCounter = 1 To UBound(tempServArea) ' loop through indivudula vendor service area
Debug.Print "ubound of tempServArea is:" & UBound(tempServArea)
Next subArrayCounter
Next venCounter ' end loop through service areas
Next propCounter ' end loop through properties
End Sub
最终,我想运行一份报告,告诉我哪些邮政编码缺少供应商。显然,我还没完成。我希望比较上一个for
循环中的字符串,但是,正如我所说,我正在崩溃程序,我不知道为什么。