写一段vba代码,对Excel单列进行分列,以表格中文字“籍”为界,将一列分成两列
时间: 2023-02-18 14:21:51 浏览: 115
Sub SplitCol()
Dim rng As Range
Dim i As Long
Dim j As Long
Dim str As String
Set rng = Range("A1:A" & Range("A65536").End(xlUp).Row)
For i = 1 To rng.Rows.Count
str = rng.Cells(i, 1).Value
For j = 1 To Len(str)
If Mid(str, j, 1) = "籍" Then
rng.Cells(i, 2).Value = Right(str, Len(str) - j)
rng.Cells(i, 1).Value = Left(str, j - 1)
Exit For
End If
Next j
Next i
End Sub
阅读全文