- 帖子
- 472
- 主題
- 5
- 精華
- 0
- 積分
- 485
- 點名
- 0
- 作業系統
- Windows
- 軟體版本
- MS Office
- 閱讀權限
- 100
- 性別
- 男
- 來自
- 香港
- 註冊時間
- 2010-7-4
- 最後登錄
- 2014-12-28

|
3#
發表於 2011-12-28 14:09
| 只看該作者
試試這樣(我沒有測試)
但是如果要寫10000 個cell,不會快很多.- Private Sub jump123()
- Application.Calculation = xlCalculationManual
- Application.ScreenUpdating = False
- For a = 2 To 10000
- If Cells(a, 1) = "" Then Exit For
- s = Left(Cells(a, 4), 6)
- b = False
- If s = "201106" Then
- b = True
- Cells(a, 5) = "A"
- ElseIf s = "201101" Then
- b = True
- Cells(a, 5) = "B"
- ElseIf s = "201111" Then
- b = True
- Cells(a, 5) = "C"
- ElseIf s = "201102" Then
- b = True
- Cells(a, 5) = "D"
- ElseIf s = "201127" Then
- b = True
- Cells(a, 5) = "E"
- End If
- If Not (b) Then
- k1 = Left(s, 2)
- If k1 = "11" Then
- k2 = Mid(s, 3, 2)
- If k2 >= "01" And k2 <= "17" Then
- Cells(a, 5) = Chr(69 + Val(k2))
- ElseIf k2 >= "18" And k2 <= "20" Then
- Cells(a, 5) = Chr(70 + Val(k2))
- End If
- End If
- End If
- Next a
- Application.Calculation = xlCalculationAutomatic
- Application.ScreenUpdating = True
- End Sub
複製代碼 |
|