|
多个分表合并,vba是最合适的。这是我自己的合并vba,可以把一个工作簿中除去不要合并的表,剩下的都合并到一个表里。
Sub hbdate()
'
' ddd Macro
'
Worksheets("合并表").Select
Rows("2:2000").Select
Selection.ClearContents
j = 2
For Each ws In Worksheets
If ws.Name <> "非合并表1" And ws.Name <> "非合并表2" And ws.Name <> "非合并表3" And ws.Name <> "非合并表3" Then
arr = Sheets(ws.Name).Range("A1:W2000")
Worksheets("合并表").Select
For i_1 = 2 To UBound(arr, 1)
If arr(i_1, 1) > 0 And arr(i_1, 1) <> "a" And arr(i_1, 1) <> "备用" Then
For i_2 = 1 To UBound(arr, 2)
Cells(j, i_2).Value = arr(i_1, i_2)
'Debug.Print arr(i_1, 1) '测试
Next i_2
j = j + 1 '在if判定完成后j增加1.
End If
Next i_1
End If
Next
End Sub |
|