编译错误,没有突出显示行 [英] Compile error no line highlighted

查看:49
本文介绍了编译错误,没有突出显示行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am getting a compile error: expected expression. No line is highlighted 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所说,名称是主要问题.

As @gtwebb stated the name was the main issue.

我发现还有其他一些小问题可以调试:

There were a couple other minor thing I found will debugging:

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

这篇关于编译错误,没有突出显示行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆