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

¦p¦ó³]©w¦Û°Ê¥[Á`vbaµ{¦¡

¦^´_ 1# agwhk
  1.     Sub test()
  2. Dim firstPos As Long, currRow As Long, lastrow As Long
  3. Dim startRng As Range

  4.    
  5.     Set startRng = ActiveSheet.Range("B3")
  6.    
  7.     lastrow = Range("B65536").End(xlUp).Row + 1
  8.     currRow = 0
  9.    
  10.     Do
  11.         With startRng
  12.             If UCase(Left(.Offset(currRow, 0).Offset(0, -1), 8)) = "SUBTOTAL" Then
  13.                 .Offset(currRow, 0).Value = Application.WorksheetFunction.Sum(Range(.Offset(firstPos, 0), .Offset(currRow - 1, 0)))
  14.                 firstPos = currRow + 1
  15.             End If
  16.         End With
  17.         currRow = currRow + 1
  18.         
  19.     Loop While startRng.Offset(currRow).Row <= lastrow

  20. End Sub
½Æ»s¥N½X
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

        ÀR«ä¦Û¦b : ¥Í®ð¡A´N¬O®³§O¤Hªº¹L¿ù¨ÓÃg»@¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD