|
- Sub test()
- Dim folderPath As String
- folderPath = "...\主程序\在同个局域网指定文件夹"
- Dim wbData As Workbook
- Set wbData = Workbooks.Open(folderPath & "资料.xlsx")
- Dim wsData As Worksheet
- Set wsData = wbData.Worksheets("数据源")
- Dim lastDataRow As Long
- lastDataRow = wsData.Cells(Rows.Count, 1).End(xlUp).Row
- /////////////
- ReDim newDataArr(1 To newDataRowCount, 1 To 8)
- Dim i As Long, j As Long
- Dim duplicate As Boolean
- Dim newRow As Long
- newRow = lastMainRow + 1
- For i = 1 To newDataRowCount
- duplicate = False
- For j = 1 To UBound(mainArr, 1)
- If dataArr(i, 1) = mainArr(j, 1) Then
- duplicate = True
- Exit For
- End If
- Next j
- If Not duplicate Then
- For j = 1 To 8
- newDataArr(i, j) = dataArr(i, j)
- Next j
- For j = 1 To 8
- ////
- Next j
- newRow = newRow + 1
- End If
- Next i
- wbData.Close
- End Sub
复制代码 |
|