EXCEL VBA排序
Sub排序()Dimbrr(131To140)c=1Fori=131To140brr(i)=39Nextarr=[EA39:EJ1039][EA39:EJ1039].Cl...
Sub 排序()
Dim brr(131 To 140)
c = 1
For i = 131 To 140
brr(i) = 39
Next
arr = [EA39:EJ1039]
[EA39:EJ1039].ClearContents
For i = 1 To 1000
For j = 131 To 140
If arr(i, j) <> "" Then
k = Val(Mid(arr(i, j), c, 1)) + 1
Cells(brr(k), k) = arr(i, j)
brr(k) = brr(k) + 1
End If
Next
Next
End Sub
这里提取 If arr(i, j) <> "" Then
131 To 140可以修改为71 To 80 展开
Dim brr(131 To 140)
c = 1
For i = 131 To 140
brr(i) = 39
Next
arr = [EA39:EJ1039]
[EA39:EJ1039].ClearContents
For i = 1 To 1000
For j = 131 To 140
If arr(i, j) <> "" Then
k = Val(Mid(arr(i, j), c, 1)) + 1
Cells(brr(k), k) = arr(i, j)
brr(k) = brr(k) + 1
End If
Next
Next
End Sub
这里提取 If arr(i, j) <> "" Then
131 To 140可以修改为71 To 80 展开
展开全部
Sub 排序()
Dim brr(71 To 80)
c = 1
For i = 71 To 80
brr(i) = 39
Next
arr = [bs39:cb1039]
[EA39:EJ1039].ClearContents
For i = 1 To 1000
For j = 71 To 80
If arr(i, j) <> "" Then
k = Val(Mid(arr(i, j), c, 1)) + 1
Cells(brr(k), k) = arr(i, j)
brr(k) = brr(k) + 1
End If
Next
Next
End Sub
追问
arr = [bs39:cb1039]
[bs39:cb1039].ClearContents
运行后,下面这里提示
If arr(i, j) "" Then下标越界
追答
Sub 排序()
Dim brr(71 To 80)
c = 1
For i = 71 To 80
brr(i) = 39
Next
arr = [bs39:cb1039]
[bs39:cb1039].ClearContents
For i = 1 To 1000
For j = 1 To 10
If arr(i, j) <> "" Then
k = Val(Mid(arr(i, j), c, 1)) + 1
Cells(brr(k), k) = arr(i, j)
brr(k) = brr(k) + 1
End If
Next
Next
End Sub
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询