- 帖子
- 463
- 主題
- 116
- 精華
- 0
- 積分
- 580
- 點名
- 0
- 作業系統
- Vista
- 軟體版本
- 2007
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2010-5-4
- 最後登錄
- 2017-11-13
 
|
回復 20# yen956
前輩!謝謝!!
你的想法與範例有所出入
小弟昨日終於想出解決方法
式程式如下請參考謝謝再三!!- Sub ExA()
- Dim C As Integer, i As Integer, R As Integer
- [A2] = 1
- [B2] = "=EDATE(B3,-1)"
- [B2].NumberFormatLocal = "[$-404]e/m/d;@"
- C = [Ag1].Column
- R = Cells(Rows.Count, [Ag1].Column).End(xlUp).Row + 1
- If R < 3 Then R = 3
- i = 2
- Do While IsDate(Cells(i, "B")) And Cells(i, "B") < Cells(R, "Z")
- If Cells(i, "B") < Cells(R, "Z") Then
- Cells(1, C) = "=SUM(R3C:R200C)"
- Cells(2, C) = "=R" & i & "C1&""筆"""
- If Cells(2, C) <> "0筆" Then Cells(R, C) = "=ROUND(r" & i & "c6 *" & [M3] & ",2)"
- C = C + 1
- i = i + 1
- End If
- Loop
- Calculate
- [Ag1] = "參照欄"
- [Ag2] = "1筆參照"
- [A2] = 0
- [B2] = "=EDATE(B1,1)"
- [B2].NumberFormatLocal = """日""""期"""
- [Ag3] = 0
- If [Ag4] <> "" Then [Ag4] = 0
- If [Ag5] <> "" Then [Ag3:Ag4].AutoFill Destination:=Range("Ag3:Ag" & [Ag1200].End(xlUp).Row), Type:=xlFillDefault
- End Sub
複製代碼 |
|