7,763
社区成员
发帖
与我相关
我的任务
分享
Dim a() As String
Dim i As Long
ReDim a(6)
a(0) = "144"
a(1) = "555"
a(2) = "652"
a(3) = "722"
a(4) = "861"
a(5) = "941"
a(6) = "123"
For i = 0 To UBound(a) - 2
If Mid$(a(i), 2, 1) = "5" Then
If Mid$(a(i + 1), 2, 1) = "2" Then
If Mid$(a(i + 2), 2, 1) = "6" Then
Mid$(a(i), 2, 1) = " "
Mid$(a(i + 1), 2, 1) = " "
Mid$(a(i + 2), 2, 1) = " "
End If
End If
End If
Next
Debug.Print Join(a, vbCrLf)
Private Sub Command1_Click()
Dim a() As String
Dim strTemp As String
Dim i As Integer
Dim intLocation As Integer
a = Split("144,555,652,722,861,941,123", ",")
intLocation = 2
For i = 0 To UBound(a)
strTemp = strTemp & Mid(a(i), intLocation, 1)
Next i
strTemp = Replace(strTemp, "526", " ")
For i = 0 To UBound(a)
Mid(a(i), intLocation, 1) = Mid(strTemp, i + 1, 1)
Debug.Print a(i)
Next i
End Sub