Home > Software engineering >  Could you tell me how to solve this? Excel vba, error 438, an object does not support this property
Could you tell me how to solve this? Excel vba, error 438, an object does not support this property

Time:11-13

Sub my_Splitter ()
Dim ar_data ar_300, ar_400 ar_500, ar_600, ar_800, ar_900
Dim myPath As String
Dim myFile As String
Dim I, j, k, m, n, l, q
Dim a, b, c, d, e, f
Application. ScreenUpdating=False
MyPath=ThisWorkbook. Path & amp; ""
Sheet1. Columns (A: "F"). Copy Destination:=Sheet3. Range (" A1 ")
With Sheet3
. Sort. SortFields. Clear
. Sort. SortFields. Add2 Key:=. The Range (" C1 "), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

With the Sort
The SetRange Range (" A2: F1117 ")
The Header=xlNo
The MatchCase=False
The Orientation=xlTopToBottom
. SortMethod=xlPinYin
. Apply
End With
End With
Ar_data=https://bbs.csdn.net/topics/Sheet3.Range (" A1 "). CurrentRegion
J=1, k=1: m=1: n=1: l=1: q=1
ReDim ar_300 (1 To UBound (ar_data), 1 To 6) : ReDim ar_400 (1 To UBound (ar_data), 1 To 6)
ReDim ar_500 (1 To UBound (ar_data), 1 To 6) : ReDim ar_600 (1 To UBound (ar_data), 1 To 6)
ReDim ar_800 (1 To UBound (ar_data), 1 To 6) : ReDim ar_900 (1 To UBound (ar_data), 1 To 6)
Sheet3. Range (" A1 ") CurrentRegion. Clear

For I=2 To UBound (ar_data)
If Val (ar_data (I, 3)) & gt;=300 And Val (ar_data (I, 3)) & lt; Then=399
J=j + 1
For a=1 To UBound (ar_data, 2)
Ar_300 (j, a)=ar_data (I, a)
Next
End the If
If Val (ar_data (I, 3)) & gt;=400 And Val (ar_data (I, 3)) & lt; Then=499
K=k + 1
A For b=1 To UBound (ar_data, 2)
=ar_data ar_400 (k, b) (I, b)
Next
End the If
If Val (ar_data (I, 3)) & gt;=500 And Val (ar_data (I, 3)) & lt; Then=599
M=m + 1
For c=1 To UBound (ar_data, 2)
Ar_500 (m, c)=ar_data (I, c)
Next
End the If
If Val (ar_data (I, 3)) & gt;=600 And Val (ar_data (I, 3)) & lt; Then=699
N=n + 1
For d=1 To UBound (ar_data, 2)
Ar_600 (n, d)=ar_data (I, d)
Next
End the If
If Val (ar_data (I, 3)) & gt;=800 And Val (ar_data (I, 3)) & lt; Then=999
L=l + 1
For e=1 To UBound (ar_data, 2)
Ar_800 (l, e)=ar_data (I, e)
Next
End the If
If Val (ar_data (I, 3)) & gt;=900 And Val (ar_data (I, 3)) & lt; Then=999
Q=q + 1
For f=1 To UBound (ar_data, 2)
Ar_900 (q, f)=ar_data (I, f)
Next
End the If
Next
Ar_300 (1, 1)=Sheet1. Range (" A1 ") : ar_300 (1, 2)=Sheet1. Range (" B1 ") : ar_300 (1, 3)=Sheet1. Range (" C1 ") : ar_300 (1, 4)=Sheet1. Range (" D1 ") : ar_300 (1, 5)=Sheet1. Range (" E1 ") : ar_300 (1, 6)=Sheet1. Range (" F1 ")
Ar_400 (1, 1)=Sheet1. Range (" A1 ") : ar_400 (1, 2)=Sheet1. Range (" B1 ") : ar_400 (1, 3)=Sheet1. Range (" C1 ") : ar_400 (1, 4)=Sheet1. Range (" D1 ") : ar_400 (1, 5)=Sheet1. Range (" E1 ") : ar_400 (1, 6)=Sheet1. Range (" F1 ")
Ar_500 (1, 1)=Sheet1. Range (" A1 ") : ar_500 (1, 2)=Sheet1. Range (" B1 ") : ar_500 (1, 3)=Sheet1. Range (" C1 ") : ar_500 (1, 4)=Sheet1. Range (" D1 ") : ar_500 (1, 5)=Sheet1. Range (" E1 ") : ar_500 (1, 6)=Sheet1. Range (" F1 ")
Ar_600 (1, 1)=Sheet1. Range (" A1 ") : ar_600 (1, 2)=Sheet1. Range (" B1 ") : ar_600 (1, 3)=Sheet1. Range (" C1 ") : ar_600 (1, 4)=Sheet1. Range (" D1 ") : ar_600 (1, 5)=Sheet1. Range (" E1 ") : ar_600 (1, 6)=Sheet1. Range (" F1 ")
Ar_800 (1, 1)=Sheet1. Range (" A1 ") : ar_800 (1, 2)=Sheet1. Range (" B1 ") : ar_800 (1, 3)=Sheet1. Range (" C1 ") : ar_800 (1, 4)=Sheet1. Range (" D1 ") : ar_800 (1, 5)=Sheet1. Range (" E1 ") : ar_800 (1, 6)=Sheet1. Range (" F1 ")
Ar_900 (1, 1)=Sheet1. Range (" A1 ") : ar_900 (1, 2)=Sheet1. Range (" B1 ") : ar_900 (1, 3)=Sheet1. Range (" C1 ") : ar_900 (1, 4)=Sheet1. Range (" D1 ") : ar_900 (1, 5)=Sheet1. Range (" E1 ") : ar_900 (1, 6)=Sheet1. Range (" F1 ")

The Open myPath & amp; "300 _. CSV" For the Output As the # 1
For I=1 To UBound (ar_300)
Print # 1, ar_300 (I, 1) & amp; ", "& amp; Ar_300 (I, 2); ", "& amp; Ar_300 (I, 3); ", "& amp; Ar_300 (I, 4); ", "& amp; Ar_300 (I, 5); ", "& amp; Ar_300 (I, 6)
Next
Close # 1

The Open myPath & amp; "400 _. CSV" For the Output As the # 1
For I=1 To UBound (ar_400)
Print # 1, ar_400 (I, 1) & amp; ", "& amp; Ar_400 (I, 2); ", "& amp; Ar_400 (I, 3); ", "& amp; Ar_400 (I, 4); ", "& amp; Ar_400 (I, 5); ", "& amp; Ar_400 (I, 6)
Next
Close # 1

The Open myPath & amp; "500 _. CSV" For the Output As the # 1
For I=1 To UBound (ar_500)
Print # 1, ar_500 (I, 1) & amp; ", "& amp; Ar_500 (I, 2); ", "& amp; Ar_500 (I, 3); ", "& amp; Ar_500 (I, 4); ", "& amp; Ar_500 (I, 5); ", "& amp; Ar_500 (I, 6)
Next
Close # 1

The Open myPath & amp; "600 _. CSV" For the Output As the # 1
For I=1 To UBound (ar_600)
Print # 1, ar_600 (I, 1) & amp; ", "& amp; Ar_600 (I, 2); ", "& amp; Ar_600 (I, 3); ", "& amp; Ar_600 (I, 4); ", "& amp; Ar_600 (I, 5); ", "& amp; Ar_600 (I, 6)
Next
Close # 1

The Open myPath & amp; "800 _. CSV" For the Output As the # 1
For I=1 To UBound (ar_800)
Print # 1, ar_800 (I, 1) & amp; ", "& amp; Ar_800 (I, 2); ", "& amp; Ar_800 (I, 3); ", "& amp; Ar_800 (I, 4); ", "& amp; Ar_800 (I, 5); ", "& amp; Ar_800 (I, 6)
Next
Close # 1

The Open myPath & amp; "900 _. CSV" For the Output As the # 1
For I=1 To UBound (ar_900)
nullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related