|
- Sub test()
- Dim Rng As Range, RG As Range, I&, K&, K1&, J&, ooo
- Set Rng = Application.InputBox("选择指定区域", "选择框", Type:=8)
- For Each RG In Rng
- K = 0: J = 0
- For I = 1 To Len(RG) + 1
- K1 = K
- If Mid(RG & "/", I, 1) = "/" Then
- K = 0
- ooo = Mid(RG, I, 1)
- K = K + I: J = J + 1
- ' Debug.Print I
- ' Debug.Print Mid(RG, I, 1)
- ' Debug.Print "K=" & K, "K1=" & K1
- ' Stop
- If J = 1 Then
- RG.Characters(K1 + 1, K - K1 - 1).Font.ColorIndex = 8
- RG.Characters(K1 + 1, K - K1 - 1).Font.Bold = True
- ElseIf J = 2 Then
- RG.Characters(K1 + 1, K - K1 - 1).Font.ColorIndex = 8
- RG.Characters(K1 + 1, K - K1 - 1).Font.Bold = True
- ElseIf J = 3 Then
- RG.Characters(K1 + 1, K - K1 - 1).Font.ColorIndex = 8
- RG.Characters(K1 + 1, K - K1 - 1).Font.Bold = True
- ElseIf J = 4 Then
- RG.Characters(K1 + 1, K - K1 - 1).Font.ColorIndex = 8
- RG.Characters(K1 + 1, K - K1 - 1).Font.Bold = True
- ElseIf J = 5 Then
- RG.Characters(K1 + 1, K - K1 - 1).Font.ColorIndex = 8
- RG.Characters(K1 + 1, K - K1 - 1).Font.Bold = True
- End If
- Else
-
- End If
- Next I
- Next
复制代码 |
|