返回列表 上一主題 發帖

[發問] 總表匯集試問

回復 1# macro0029
  1. Sub ex()
  2. Dim ar(), ay()
  3. With Sheets("總表")
  4. r = 2
  5. Do Until .Cells(r, 1) = ""
  6. If .Cells(r, "J") = "收支調整" Then
  7.    If .Cells(r, "A") = "7070" Then
  8.       ReDim Preserve ar(s)
  9.       ar(s) = Array(.Cells(r, "A"), .Cells(r, "D"), .Cells(r, "E"), .Cells(r, "F"), .Cells(r, "G") & .Cells(r, "H"), .Cells(r, "I"), .Cells(r, "J"))
  10.       s = s + 1
  11.       Else
  12.       ReDim Preserve ay(i)
  13.       ay(i) = Array(.Cells(r, "A"), .Cells(r, "D"), .Cells(r, "E"), .Cells(r, "F"), .Cells(r, "G") & .Cells(r, "H"), .Cells(r, "I"), .Cells(r, "J"))
  14.       i = i + 1
  15.     End If
  16. End If
  17. r = r + 1
  18. Loop
  19. End With
  20. Sheets("製票機構是7070且類別為收支調整").[A2].Resize(s, 7) = Application.Transpose(Application.Transpose(ar))
  21. Sheets("製票機構非7070且類別為收支調整").[A2].Resize(i, 7) = Application.Transpose(Application.Transpose(ay))
  22. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 口說好話、心想好意、身行好事。
返回列表 上一主題