|
本帖最后由 hasyh2008 于 2018-7-17 13:34 编辑
Sub 汇总()
Dim x%, y%, str As String
For x = 3 To Range("A" & Rows.Count).End(xlUp).Row
For y = 1 To 12
str = Range("A" & x).Value
Cells(x, y + 2) = Application.VLookup(str, Sheets(y & "月").Range("A:C"), 3, False)
If Cells(x, y + 2).Text = "#N/A" Then
Cells(x, y + 2).Value = 0
End If
Range("O" & x) = WorksheetFunction.Sum(Range("C" & x).Resize(1, 12))
Next y
Next x
End Sub
Sub 清除()
Range("C3:O" & Rows.Count).ClearContents
End Sub
Sub 提取物资名称()
Dim i%
For i = 1 To 12
Sheets(i & "月").Select
Sheets(i & "月").Range("A3:B" & Sheets(i & "月").Range("B" & Rows.Count).End(xlUp).Row).Select
Selection.Copy Sheet13.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Next i
Sheet13.Select
ActiveSheet.Range("A2:B" & Sheet13.Range("B" & Rows.Count).End(xlUp).Row).RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
End Sub
|
评分
-
1
查看全部评分
-
|