返回列表 上一主題 發帖

複製公式

回復 20# yen956
前輩!謝謝!!
         你的想法與範例有所出入
         小弟昨日終於想出解決方法
          式程式如下請參考謝謝再三!!
  1. Sub ExA()
  2.     Dim C As Integer, i As Integer, R As Integer
  3.     [A2] = 1
  4.     [B2] = "=EDATE(B3,-1)"
  5.     [B2].NumberFormatLocal = "[$-404]e/m/d;@"
  6.     C = [Ag1].Column
  7.     R = Cells(Rows.Count, [Ag1].Column).End(xlUp).Row + 1
  8.     If R < 3 Then R = 3
  9.     i = 2
  10.     Do While IsDate(Cells(i, "B")) And Cells(i, "B") < Cells(R, "Z")
  11.         If Cells(i, "B") < Cells(R, "Z") Then
  12.             Cells(1, C) = "=SUM(R3C:R200C)"
  13.             Cells(2, C) = "=R" & i & "C1&""筆"""
  14.          If Cells(2, C) <> "0筆" Then Cells(R, C) = "=ROUND(r" & i & "c6 *" & [M3] & ",2)"
  15.             C = C + 1
  16.             i = i + 1
  17.         End If
  18.     Loop
  19.        Calculate
  20.        [Ag1] = "參照欄"
  21.        [Ag2] = "1筆參照"
  22.        [A2] = 0
  23.        [B2] = "=EDATE(B1,1)"
  24.        [B2].NumberFormatLocal = """日""""期"""
  25.        [Ag3] = 0
  26.     If [Ag4] <> "" Then [Ag4] = 0
  27.     If [Ag5] <> "" Then [Ag3:Ag4].AutoFill Destination:=Range("Ag3:Ag" & [Ag1200].End(xlUp).Row), Type:=xlFillDefault
  28. End Sub
複製代碼

LeoV78-3A.gif (633.17 KB)

LeoV78-3A.gif

LeoV78-3A.rar (13.38 KB)

TOP

        靜思自在 : 待人退一步,愛人寬一寸,就會活得很快樂。
返回列表 上一主題