EXCEL 对单元格的内容按行标序号
程序员文章站
2022-03-16 18:45:16
...
对单元格的内容按行标序号,通过VBA写如下代码实现:
效果如下:
Sub ffll()
Dim k
For i = 1 To 10 Step 1
k = Range("A" & i).Value
arr = Split(k, Chr(10))
For j = LBound(arr) To UBound(arr)
ss = ss & j
ss = ss & ","
ss = ss & arr(j)
If j < UBound(arr) Then
ss = ss & Chr(10)
End If
Next j
Range("B" & i).Value = ss
ss = ""
Next i
End Sub