我收到一个编译错误:预期的表达式。没有突出显示的行 XD
Sub name()
Dim arr() As String
Dim lastRow As Long
c = 2
With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To lastRow
arr = Split(.Cells(i, 1), " ")
For Each e In arr
.Cells(i, c).Value = arr(e)
c = c + 1
Next
Set arr = Empty
Next
End With
End Sub
最佳答案
正如@gtwebb 所说,名称是主要问题。
我发现还有一些其他的小事情会调试:
Sub name2()
Dim e As Variant
Dim lastRow As Long
Dim c As Integer
Dim arr() As String
c = 2
With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To lastRow
c = 2
arr = Split(.Cells(i, 1), " ")
For Each e In arr
.Cells(i, c).Value = e
c = c + 1
Next
Next
End With
End Sub
关于excel - 编译错误没有突出显示的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36756773/