编译错误没有突出显示的行

时间:2016-04-20 23:06:47

标签: excel excel-vba vba

我收到编译错误:期望的表达式。没有突出显示的行XD

False

1 个答案:

答案 0 :(得分:3)

正如@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

enter image description here