- 帖子
- 8
- 主題
- 3
- 精華
- 0
- 積分
- 16
- 點名
- 0
- 作業系統
- xp
- 軟體版本
- sp3
- 閱讀權限
- 10
- 性別
- 男
- 註冊時間
- 2010-10-26
- 最後登錄
- 2010-11-30
|
2#
發表於 2010-11-17 14:50
| 只看該作者
各位大大..問題大致處理好了,不起意思打擾各位。
主程式
Private Sub CommandButton1_Click()
Dim a As Integer
Call aa
End Sub
副程式
Sub aa() 'Function aa() '本國籍一般、外籍國籍-越南、柬普寨、柬普寨、泰國、菲律賓、印尼、其他
Dim strYear As String '變數-統計的年月
Dim strNo As String '變數-案號的年月
Dim strCountry As String '變數-國籍
Dim intAmount As Integer '變數-筆數
Dim i, l, h, b, ii As Integer '變數-欄 列
Dim j, w As Integer '變數-統計數
j = 0
w = 0
a = 57
While a < 72
b = a
c = b + 1
intAmount = Application.CountA(Sheets("受虐者").Range("A2:A65535")) + 1 '取筆數
For h = b To c
For l = 12 To 23
Select Case h
Case Is <= 58
ii = 37
Case Is <= 62
ii = 41
Case Is <= 64
ii = 43
Case Is <= 66
ii = 45
Case Is <= 68
ii = 47
Case Is <= 70
ii = 49
Case Is <= 72
ii = 51
End Select
strYear = Application.WorksheetFunction.Text((Sheets("季統計").Cells(2, 3) & Sheets("季統計").Cells(5, l)), 0)
strCountry = Application.WorksheetFunction.Text((Sheets("季統計").Cells(h, 3) & "-" & Sheets("季統計").Cells(h, 4)), 0)
'取年月份-季統計
For i = 2 To intAmount
strNo = Mid(Sheets("受虐者").Cells(i, 1), 3, 4)
If strNo = strYear Then '年月份-判斷案號是否等於季統計
If Sheets("受虐者").Cells(i, 4) = "成案" Then '成案-判斷案件是否成案
If Sheets("受虐者").Cells(i, h - ii) = strCountry Then '受虐者本身特殊狀況-判斷受虐者本身特殊狀況是否屬實
j = j + 1
End If
End If
End If
w = j
Next i
j = 0
Sheets("季統計").Cells(h, l).Value = w
Next l
Next h
a = a + 2
Wend
End Sub |
|