|
汇总工作表的C列里要是有等于米粉或者辅食小件里的A列的单号时插入一行,A,B,C,D,F,G,H,I,K都是等于上行的内容,e列里插入的行的话等于米粉或者辅食小件的C列,E列插入的行的上一行则等于自身的数减去插入行的数(插入行的数是米粉或者辅食小件的C列)。求大神帮帮忙,我已经琢磨了一天了还是没琢磨出来,所以来请教一下,我这个到底是哪里出问题了,件数总是不对(件数是E列执行后等于720才是正确的)能不能帮我修改一下我的代码,感激不尽!
- ' Dim arr, azz
- ' Set d = CreateObject("scripting.dictionary") '字典
- ' Set f = CreateObject("scripting.dictionary")
- 'With Sheets("辅食小件") '作用于工作表
- ' arr = Sheets("辅食小件").UsedRange 'arr = 使用的单元格
- ' azz = Sheets("米粉").Range([a1], [a65536].End(3))
- ' For i = 1 To UBound(arr) ' i = 1到 使用的单元格
-
-
-
- ' d(arr(i, 1)) = i '字典 中的第一行等于 i
- ' For Z = 1 To UBound(azz)
- '
- ' f(azz(Z, 1)) = Z
- ' Next: Next
-
- ' End With
-
-
-
- ' With Sheets("汇总工作表")
- ' R = [a65536].End(xlUp).Row
- ' arr = .Range("a1:c" & R)
- ' For i = R To 1 Step -1
-
-
-
- ' If d.exists(arr(i, 3)) Then
- ' Rows(i + 1).Insert
- ' Cells(i + 1, 1) = Cells(i, 1)
- ' Cells(i + 1, 2) = Cells(i, 2)
- ' Cells(i + 1, 3) = Cells(i, 3)
- ' Cells(i + 1, 4) = Cells(i, 4)
- ' Cells(i + 1, 6) = Cells(i, 6)
- ' Cells(i + 1, 7) = Cells(i, 7)
- ' Cells(i + 1, 8) = Cells(i, 8)
- ' Cells(i + 1, 9) = Cells(i, 9)
- ' Cells(i + 1, 11) = Cells(i, 11)
- ' Cells(i + 1, 10) = "辅食小"
- ' Cells(i + 1, 5) = Application.VLookup(Cells(i + 1, 3), Worksheets("辅食小件").Range("A:C"), 3, 0)
-
-
- ' End If
-
-
-
- 'If f.exists(arr(i, 3)) Then
-
- ' Rows(i).Insert
- ' Cells(i - 1, 1) = Cells(i, 1)
- ' Cells(i - 1, 2) = Cells(i, 2)
- '' Cells(i - 1, 3) = Cells(i, 3)
- ' Cells(i - 1, 4) = Cells(i, 4)
- ' Cells(i - 1, 6) = Cells(i, 6)
- ' Cells(i - 1, 7) = Cells(i, 7)
- ' Cells(i - 1, 8) = Cells(i, 8)
- ' Cells(i - 1, 9) = Cells(i, 9)
- ' Cells(i - 1, 11) = Cells(i, 11)
- ' Cells(i - 1, 10) = "米粉"
- ' Cells(i - 1, 5) = Application.VLookup(Cells(i - 1, 3), Worksheets("米粉").Range("A:C"), 3, 0)
-
-
- ' End If
- ' If f.exists(arr(i, 3)) Or d.exists(arr(i, 3)) Then Cells(i, 5) = Cells(i, 5) - (Cells(i + 1, 5) + Cells(i - 1, 5))
-
-
-
-
- ' If Cells(i + 2, 10) & Cells(i + 1, 10) = "米粉小听粉" Or Cells(i + 2, 10) & Cells(i + 1, 10) = "米粉产品" Then Cells(i, 5) = Cells(i + 1, 5) + Cells(i, 5)
-
-
-
- '
- ' Next
-
- ' End With
复制代码
|
|