|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
具体问题,具体分析
Public Sub Test1()
Dim Arr
Dim i As Long
Arr = Range("A1").CurrentRegion
For i = 1 To UBound(Arr)
Arr(i, 1) = Mid(Arr(i, 1), 3)
Next i
Range("B1").Resize(UBound(Arr)) = Arr
End Sub
Public Sub Test2()
Dim Arr, Sp
Dim i As Long, j As Long
Dim Str As String
Arr = Range("A1").CurrentRegion
For i = 1 To UBound(Arr)
Str = ""
Sp = VBA.Split(Arr(i, 1), "-")
For j = 1 To UBound(Sp)
Str = Str & "-" & Sp(j)
Next j
Str = Mid(Str, 2)
Arr(i, 1) = Str
Next i
Range("B1").Resize(UBound(Arr)) = Arr
End Sub
Public Sub Test3()
Dim Arr
Dim i As Long
Arr = Range("A1").CurrentRegion
For i = 1 To UBound(Arr)
Arr(i, 1) = VBA.Replace(Arr(i, 1), "J-", "")
Next i
Range("B1").Resize(UBound(Arr)) = Arr
End Sub
|
|