ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¦p¦ó±N³o¥y+{sum(if......,if......,))}, ¥Î¦bMacro¸Ì­±??

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-12-24 17:46 ½s¿è

¦^´_ 1# idsmchow
¦Û°Ê¿z¿ï
  1. Option Explicit
  2. Sub Ex()
  3.     Dim C As Integer
  4.     C = 10
  5.     With Sheets("Report")
  6.         Do Until .Cells(C, "B") = ""
  7.             If .Cells(C, "A") = "" Then
  8.                 .Range(.Cells(C, "E"), .Cells(C, "G")) = 0
  9.             ElseIf .Cells(C, "A") = "Y" Then
  10.                 Sheets("Data").Cells.AutoFilter
  11.                 Sheets("Data").Cells.AutoFilter 1, "A"
  12.                 Sheets("Data").Cells.AutoFilter 2, .Cells(C, "B")
  13.                 .Cells(C, "E") = Application.Sum(Sheets("Data").Columns(3).SpecialCells(xlCellTypeVisible))
  14.                 Sheets("Data").Cells.AutoFilter
  15.                 Sheets("Data").Cells.AutoFilter 1, "B"
  16.                 Sheets("Data").Cells.AutoFilter 2, .Cells(C, "B")
  17.                 .Cells(C, "F") = Application.Sum(Sheets("Data").Columns(3).SpecialCells(xlCellTypeVisible))
  18.                 .Cells(C, "G") = .Cells(C, "E") + .Cells(C, "F")
  19.             End If
  20.             C = C + 1
  21.         Loop
  22.     End With
  23.     Sheets("Data").AutoFilterMode = False
  24. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤f»¡¦n¸Ü¡B¤ß·Q¦n·N¡B¨­¦æ¦n¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD