Home > Software engineering >  VBA, assigned to the array, array showed a null value
VBA, assigned to the array, array showed a null value

Time:03-03

Topic request post, want to ask me where the program logic is wrong in
Two problems
Always say after 1 assigned area to the array subscript crossing the line array values, may be the array is empty, but in fact the regional assignment not to empty
2 then said range on the worksheet failure

We had an afternoon also don't know,
Worksheets (workbook name). The range (cells (), cells ())
This expression is wrong? If can't refer to the how to fix it? Is there free will? Few question mark for the first time, thank you very much willing to answer students

CodePudding user response:

The
refer to the original poster qq_44093147 response:
topic request stick up, want to ask me where the program logic is wrong in
Two problems
Always say after 1 assigned area to the array subscript crossing the line array values, may be the array is empty, but in fact the regional assignment not to empty
2 then said range on the worksheet failure

We had an afternoon also don't know,
Worksheets (workbook name). The range (cells (), cells ())
This expression is wrong? If can't refer to the how to fix it? Is there free will? 第一次提问分数不多,万分感谢愿意回答的同学

Sub (d)

Dim j, As Long As Long, I name As String, wname As Worksheet, name1 As String, RNG As Range, name2 As Range, a ()
J=2
Worksheets (" attendance statistics "). Activate
For j=2 To 22

Name=Cells (1, j). The Value

The Set wname=Worksheets (name)

The Set RNG=wname. Range (Cells (3, 2), Cells (3, 2). The End (xlDown))
A=RNG
I=1

For I=LBound (a) To UBound (a)

Set name2=Worksheets (" attendance statistics "). The Cells. The Find (name1)

If Not name2 Is Nothing Then
Name2. Offset (0, j - 1) Value="https://bbs.csdn.net/topics/yes"
End the If
Next I
Next j
This is the program

CodePudding user response:

Then this formula, the end (xldown) shows - 4121, is this why

CodePudding user response:

Excel to run such a big table is not a problem, still have even if I understand into set wname=worksheets (name) this code is what you want to refer to one or more tables, and the name in brackets should be one or more table the table name, so there will be a function object error prompt,
I also checked the code, how to use the specific is not running, hope to help you,

CodePudding user response:

sound cloud wind language reference 3 floor response:
Excel to run such a big table is not a problem, still have even if I understand into the set wname=worksheets (name) this code is what you want to refer to one or more tables, and the name in brackets should be one or more table the table name, so there will be a function object error prompt,
I also checked the code, how to use the specific is not running, hope to help you,

Yeah yeah right, but when I simplify, don't use cycle, working in a table reference another form of area, she is still an error

CodePudding user response:

sound cloud wind language reference 3 floor response:
Excel to run such a big table is not a problem, still have even if I understand into the set wname=worksheets (name) this code is what you want to refer to one or more tables, and the name in brackets should be one or more table the table name, so there will be a function object error prompt,
I also checked the code, how to use the specific is not running, hope to help you,

Answer code is more complex, it is found names in statistical list one by one, each selected names to open the back 22 meeting records one by one to find whether have the same value

CodePudding user response:

A=RNG wrong here, a is an array, the RNG is an array of objects, can not so assignment;

CodePudding user response:

Resolved, need not reply
  •  Tags:  
  • VBA