|
Sub 汇总数据()
Dim wsSource As Worksheet
Dim wsTarget As Worksheet
Dim i As Long
Dim targetRow As Long
Set wsSource = ThisWorkbook.Sheets("生产单")
Set wsTarget = ThisWorkbook.Sheets("制单需求表")
wsTarget.Rows("2:" & wsTarget.Rows.Count).ClearContents
targetRow = 2
wsTarget.Cells(targetRow, "A").Value = wsSource.Cells(2, "B").Value
For i = 3 To 25
If i = 21 Then
GoTo SkipRow
End If
If wsSource.Cells(i, "B").Value <> "" Then
wsTarget.Cells(targetRow, "B").Value = wsSource.Cells(i, "F").Value
wsTarget.Cells(targetRow, "C").Value = wsSource.Cells(i, "G").Value
wsTarget.Cells(targetRow, "D").Value = wsSource.Cells(i, "H").Value
wsTarget.Cells(targetRow, "E").Value = wsSource.Cells(i, "I").Value
wsTarget.Cells(targetRow, "F").Value = wsSource.Cells(i, "J").Value
wsTarget.Cells(targetRow, "G").Value = wsSource.Cells(i, "K").Value
wsTarget.Cells(targetRow, "H").Value = wsSource.Cells(i, "L").Value
wsTarget.Cells(targetRow, "I").Value = wsSource.Cells(i, "M").Value
targetRow = targetRow + 1
End If
SkipRow:
Next i
MsgBox "数据汇总完成!", vbInformation
End Sub
|
|