- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 142
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2026-7-16
                
|
本帖最後由 Hsieh 於 2011-1-6 14:11 編輯
回復 3# hugh0620 - Private Sub CommandButton1_Click()
- Dim st As Date, ed As Date
- st = InputBox("請輸入起始日期", , Date)
- ed = InputBox("請輸入結束日期", , Date + 30)
- Set a = Columns("A").Find(st, LookIn:=xlValues)
- Set b = Columns("A").Find(ed, LookIn:=xlValues)
- If a Is Nothing Or b Is Nothing Then MsgBox "The day is not found": Exit Sub
- [E2] = Application.Sum(Range(a.Offset(, 4), b.Offset(, 4)))
- MsgBox Application.Sum(Range(a.Offset(, 4), b.Offset(, 4)))
- End Sub
複製代碼 |
|