Home > Software engineering >  [for] the horizontal merger worksheet prompt subscript crossing the line
[for] the horizontal merger worksheet prompt subscript crossing the line

Time:12-01

All worksheets in the workbook for horizontal mergers, code see annex, run time always prompt subscript bounds, troublesome everybody a great god to see where the problem is, thank you very much

CodePudding user response:

CodePudding user response:

1. Clear, which sentence is wrong,

2. "the problem code", "block" (or text) way to stick out, do not use images (of course there can be "additional instructions" on the picture),
Do you think people really have such a high interest, knock you that a large code???

CodePudding user response:

I'm very sorry, for the first time to post, the code has been uploaded, thank you
 Sub test () 
Dim I %, r %
Dim arr, BRR
Dim d As Object
Dim d1 As Object
The Set d=CreateObject (" scripting. The dictionary ")
The Set d1=CreateObject (" scripting. The dictionary ")
Dim the ws As Worksheet
M=1
For Each ws Worksheets In
If the ws. The Name & lt;> "Summary" Then
With the ws
R=. Cells (. Rows. The Count, 1). The End (xlUp). Row
C=. Cells (1. The Columns. The Count). The End (xlToLeft). The Column
Arr=. Range (" a1 "). The Resize (r, c)
For I=2 To UBound (arr)
If Not d.e xists (arr (I, 1)) Then
ReDim BRR (1 To 100)
BRR (1)=arr (I, 1)
The Else
BRR=d (arr (I, 1))
End the If
For j=2 To UBound (arr, 2)
If Not d1. The exists (arr (1, j)) Then
M=m + 1
D1 (arr (1, j))=m
End the If
-> error line BRR (d1 (arr (1, j)))=BRR (d1 (arr (1, j))) + arr (I, j)
Next
D (arr (I, 1))=BRR
Next
End With
End the If
Next
With Worksheets (" summary ")
. The Cells. The Clear
Range (" a1 ")="country"
Range (" b1 "). The Resize (1, d1. Count)=d1. Keys
Range (" a2 "). The Resize (, dc mount, 100)=Application. The Transpose (Application. The Transpose (d.i tems))
R=. Cells (. Rows. The Count, 1). The End (xlUp). Row
Range (" a1 "). The Resize (r, d1. Count + 1) Borders. Graphics.linestyle=xlContinuous
End With
End Sub

CodePudding user response:

reference qq_38851046 reply: 3/f
I'm very sorry, for the first time Posting, code has been uploaded, thank you
 Sub test () 
Dim I %, r %
Dim arr, BRR
Dim d As Object
Dim d1 As Object
The Set d=CreateObject (" scripting. The dictionary ")
The Set d1=CreateObject (" scripting. The dictionary ")
Dim the ws As Worksheet
M=1
For Each ws Worksheets In
If the ws. The Name & lt;> "Summary" Then
With the ws
R=. Cells (. Rows. The Count, 1). The End (xlUp). Row
C=. Cells (1. The Columns. The Count). The End (xlToLeft). The Column
Arr=. Range (" a1 "). The Resize (r, c)
For I=2 To UBound (arr)
If Not d.e xists (arr (I, 1)) Then
ReDim BRR (1 To 100)
BRR (1)=arr (I, 1)
The Else
BRR=d (arr (I, 1))
End the If
For j=2 To UBound (arr, 2)
If Not d1. The exists (arr (1, j)) Then
M=m + 1
D1 (arr (1, j))=m
End the If
-> error line BRR (d1 (arr (1, j)))=BRR (d1 (arr (1, j))) + arr (I, j)
Next
D (arr (I, 1))=BRR
Next
End With
End the If
Next
With Worksheets (" summary ")
. The Cells. The Clear
Range (" a1 ")="country"
Range (" b1 "). The Resize (1, d1. Count)=d1. Keys
Range (" a2 "). The Resize (, dc mount, 100)=Application. The Transpose (Application. The Transpose (d.i tems))
R=. Cells (. Rows. The Count, 1). The End (xlUp). Row
Range (" a1 "). The Resize (r, d1. Count + 1) Borders. Graphics.linestyle=xlContinuous
End With
End Sub

Suggest the building directly upload attachments, because your data in it, only look at the code, can not find the problem,

CodePudding user response:


There is no way to upload the excel, I cut a figure, the 0301-0302-0303-0301-0302-0303 six Sheet table data format is the same, differences in the number of columns, want to combine data horizontally, thank you

CodePudding user response:

reference 4 floor sniperhgy response:
Quote: reference qq_38851046 reply: 3/f

I'm very sorry, for the first time to post, the code has been uploaded, thank you
 Sub test () 
Dim I %, r %
Dim arr, BRR
Dim d As Object
Dim d1 As Object
The Set d=CreateObject (" scripting. The dictionary ")
The Set d1=CreateObject (" scripting. The dictionary ")
Dim the ws As Worksheet
M=1
For Each ws Worksheets In
If the ws. The Name & lt;> "Summary" Then
With the ws
R=. Cells (. Rows. The Count, 1). The End (xlUp). Row
C=. Cells (1. The Columns. The Count). The End (xlToLeft). The Column
Arr=. Range (" a1 "). The Resize (r, c)
For I=2 To UBound (arr)
If Not d.e xists (arr (I, 1)) Then
ReDim BRR (1 To 100)
BRR (1)=arr (I, 1)
The Else
BRR=d (arr (I, 1))
End the If
For j=2 To UBound (arr, 2)
If Not d1. The exists (arr (1, j)) Then
M=m + 1
D1 (arr (1, j))=m
End the If
-> error line BRR (d1 (arr (1, j)))=BRR (d1 (arr (1, j))) + arr (I, j)
Next
D (arr (I, 1))=BRR
Next
End With
End the If
Next
With Worksheets (" summary ")
. The Cells. The Clear
Range (" a1 ")="country"
Range (" b1 "). The Resize (1, d1. Count)=d1. Keys
Range (" a2 "). The Resize (, dc mount, 100)=Application. The Transpose (Application. The Transpose (d.i tems))
R=. Cells (. Rows. The Count, 1). The End (xlUp). Row
Range (" a1 "). The Resize (r, d1. Count + 1) Borders. Graphics.linestyle=xlContinuous
End With
End Sub
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related