返回列表 上一主題 發帖

哇頭大囉!哈哈!!

回復 1# myleoyes
  1. Sub Ex()
  2.     Dim R%
  3.     If ActiveCell.Column >= 3 And ActiveCell.Column <= 15 Then
  4.         If ActiveCell.Column Mod 2 > 0 Then
  5.             R = (ActiveCell.Row - 2) Mod 12
  6.             If R >= 0 And R <= 11 Then
  7.                 ActiveCell.Copy Cells(2, ActiveCell.Column)
  8.                 Cells(2, ActiveCell.Column + 1) = ActiveCell.Offset(12, 1) - ActiveCell.Offset(, 1)
  9.             End If
  10.         End If
  11.     End If
  12. End Sub
複製代碼

TOP

本帖最後由 GBKEE 於 2010-6-26 19:59 編輯

回復 3# myleoyes
Leov11  是連續的範圍  Leov11-1 中間有隱藏的範圍是不同的
  1. Sub Ex()
  2.     Dim R, A, C, Rng As Range, II%
  3.     If ActiveCell.Column >= 3 And ActiveCell.Column <= 15 Then
  4.         If ActiveCell.Column Mod 2 > 0 Then
  5.             R = (ActiveCell.Row - 5) Mod 12
  6.             If R >= 0 And R <= 11 Then
  7.                 ActiveCell.Copy Cells(2, ActiveCell.Column)
  8.                 Application.EnableEvents = False
  9.                 Set Rng = ActiveCell.EntireColumn.SpecialCells(xlCellTypeVisible)
  10.                 For Each C In Rng.Areas
  11.                     For Each A In C.Cells
  12.                         If A.Row = ActiveCell.Row Then II = 1
  13.                         If II > 0 Then II = II + 1
  14.                         If II = 14 Then
  15.                             Cells(2, ActiveCell.Column + 1) = ActiveCell.Offset(, 1) - A.Offset(, 1)
  16.                             Application.EnableEvents = True
  17.                             Exit Sub
  18.                         End If
  19.                     Next
  20.                 Next
  21.             End If
  22.         End If
  23.     End If
  24. End Sub
複製代碼

TOP

回復 6# myleoyes
Cells(2, ActiveCell.Column + 1) = Val(ActiveCell.Offset(, 1)) - Val(A.Offset(, 1))

TOP

        靜思自在 : 屋寬不如心寬。
返回列表 上一主題