标识符太长 [英] Identifier too long

查看:150
本文介绍了标识符太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到这个问题:标识太长。我可以做些什么来解决这个问题?我尝试使用休息_。但是会出现另一个错误:缺少末端括号。谢谢你们。

I am faced with this problem: "Identifier too long". What can I do to fix this? I tried using a break "_" . But there will another error: Missing end bracket. Thanks guys.

 Sub Netting()

     Dim Found As Range
     Dim LR As Long
     Dim ws As Worksheet
     Dim cell As Range
     Dim a As Variant, v As Variant, num

     Set ws = Sheets("PAYABLES - OUTFLOWS")

     Set Found = ws.Rows(1).Find(What:="Invoice Amount", _
                                LookIn:=xlValues, lookat:=xlWhole)
     If Found Is Nothing Then Exit Sub

     a = [{"991",1042;"916", 1042;"954",261;"975",3004;"938",726;"901",762;"482",728; _
            "482",728;"934",723;"200",724;"201",724;"952",724;"992",3030;"980",3207;"116",626;"939",722;"390",517;"484",548;"339",59;"141",717;"935",59;"994",3370;"140",8408;"950",775;"370", 734 }] 'create 2-d lookup array

     LR = ws.Cells(ws.Rows.Count, Found.Column).End(xlUp).Row
     Found.Offset(0, 1).EntireColumn.Insert
     ws.Cells(1, Found.Column + 1).Value = "Netting"

     For Each cell In ws.Range(ws.Range("C2"), ws.Cells(LR, 3))
        num = CStr(Mid(cell.Value, 3, 3))
        v = Application.VLookup(num, a, 2, False)
        cell.EntireRow.Cells(Found.Column + 1).Value = IIf(IsError(v), "", v)
     Next cell

End Sub


推荐答案

有一个限制每行字符数。您可以使用更简单的方法来实现此目的。将您的数据添加到电子表格(例如Sheet1),并在列A和列B中。

There is a limit on the number of characters per line. You can accomplish this using a much simpler way. Add your data to a spreadsheet ("Sheet1" for example) and in column A and column B.

Sub Assign2DVector()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Worksheets("Sheet1")
    Dim a As Variant
    a = ws.Range("A1:B20").Value ' set to whatever your actual range is
End Sub

这篇关于标识符太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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