|
Sub 提交菜品()
Application.ScreenUpdating = False
Dim ar As Variant
Dim d As Object
Set d = CreateObject("scripting.dictionary")
lj = ThisWorkbook.Path & "\"
f = Dir(lj & "基础信息表.xls*")
If f = "" Then MsgBox "找不到基础信息表": End
With Sheets("菜品成本核算")
ar = .Range("a1:l76")
End With
Set wb = Workbooks.Open(lj & f, 0)
With wb.Worksheets("菜品基本信息")
h = UBound(ar)
br = .Range("a1:aj" & h)
r = .Cells(Rows.Count, 1).End(xlUp).Row
For j = 8 To UBound(br, 2)
If Trim(br(4, j)) <> "" Then
d(Trim(br(4, j))) = j
End If
Next j
n = r
For i = 15 To 35
If Trim(ar(i, 4)) <> "" Then
n = n + 1
br(n, 1) = ar(3, 10)
br(n, 3) = ar(5, 10)
br(n, 4) = ar(6, 10)
br(n, 5) = ar(i, 2)
br(n, 6) = ar(i, 4)
br(n, 7) = ar(i, 6)
End If
Next i
For i = 36 To 54
If Trim(ar(i, 4)) <> "" Then
lh = d(Trim(ar(i, 2)))
If lh <> "" Then
br(n, lh) = ar(i, 4)
br(n, lh + 1) = ar(i, 6)
End If
End If
Next i
For i = 55 To 76
If Trim(ar(i, 4)) <> "" Then
lh = d(Trim(ar(i, 2)))
If lh <> "" Then
br(n, lh) = ar(i, 4)
End If
End If
Next i
.[a1].Resize(n, UBound(br, 2)) = br
End With
Set d = Nothing
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
评分
-
1
查看全部评分
-
|