- 帖子
- 835
- 主題
- 6
- 精華
- 0
- 積分
- 915
- 點名
- 0
- 作業系統
- Win 10,7
- 軟體版本
- 2019,2013,2003
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2010-5-3
- 最後登錄
- 2025-7-5
|
本帖最後由 luhpro 於 2013-10-20 21:18 編輯
回復 5# 最高機密
你誤會了.
2# 所說 須於主程式式的模組中的頂端 PUBLIC X,Y 設為公用變數 意思是變數要在 Model 中以 Public 來定義:
以下程式放在 Model 模組中 :另你的 If x > Cells(a, 1) <= y Then 則要改為
If x > Cells(a, 1) And Cells(a, 1) <= y Then
底下以你 1# 的程式為例修改 :- Sub trend()
- x = InputBox("輸入第一天")
- y = InputBox("輸入最後一天")
- For a = 2 To 486
- Call aa(a)
- Next a
- End Sub
- Sub aa(ByVal a As Integer)
- For b = 9 To 32
- If x > Cells(a, 1) And Cells(a, 1) <= y Then
- Cells(a, b + 25) = Cells(a + 2, 2) - Cells(a + 1, 2)
- Else
- Cells(a, b + 25) = Cells(a + 1, 2) - Cells(a + 2, 2)
- End If
- c = Cells(a, b + 25)
- d = d + c
- Cells(489, b + 25) = d
- e = Cells(1, b + 25)
- Cells(488, b + 25) = e
- Next
- c = 0
- Cells(1, b + 25) = Cells(1, b)
- End Sub
複製代碼
專題範本0917 (改)-a.zip (45.87 KB)
|
|