|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
Sub MoveText()’修改后\\OwenY
Dim i&, reg
Set reg = CreateObject("VBScript.RegExp")
reg.Global = True
reg.Pattern = "^[\d\、\.]+"
For i = Cells(Rows.Count, 1).End(3).Row To 4 Step -1
Select Case Left(Cells(i, 1).Value, 1)
Case "E"
Cells(i - 5, "F").Value = Mid(Cells(i, 1).Value, 4)
Rows(i).Delete
Case "D"
Cells(i - 4, "E").Value = Mid(Cells(i, 1).Value, 4)
Rows(i).Delete
Case "C"
Cells(i - 3, "D").Value = Mid(Cells(i, 1).Value, 4)
Rows(i).Delete
Case "B"
Cells(i - 2, "C").Value = Mid(Cells(i, 1).Value, 4)
Rows(i).Delete
Case "A"
Cells(i - 1, "B").Value = Mid(Cells(i, 1).Value, 4)
Rows(i).Delete
Case 1 To 9
Cells(i, 1).Value = reg.Replace(Cells(i, 1).Value, "")
Cells(i, "G").Value = Asc(Right(Cells(i, 1).Value, 1)) - 64
' ss = reg.Replace(Cells(i, 1).Value, "")
' Cells(i, 1).Value = Left(ss, Len(ss) - 5)
a = Cells(i, "B").Value
b = Cells(i, "C").Value
c = Cells(i, "D").Value
d = Cells(i, "E").Value
e = Cells(i, "F").Value
g = Cells(i, "G").Value
Temp = a
Cells(i, "B").Value = Choose(g, a, b, c, d, e, f)
Cells(i, g + 1).Value = Temp
Cells(i, "B").Font.Color = vbRed
Case Else
Rows(i).Delete
End Select
Next
End Sub
|
|