我正在尝试从 excel 文档中加载、排序和显示名称。我不断收到预期的子、功能或属性错误?
Sub load() 'this program purpose is to load , sort and display names from an excel document'
Dim names(1 To 5) As String
Dim passNum As Integer, i As Integer, temp As String
Dim num_names As Long, shift As String
num_names = 4 ' LOADS NAMES FROM EXCEL FILE'
For i = 1 To num_names
names(i) = Cells(i, 1)
Next i
Call shift
Call display
End Sub
Sub sort_1(passNum As Integer, num_names As Long, i As Integer, temp As String)' SORTS NAMES'
For passNum = 1 To (num_names - 1)
For i = 1 To (num_names - passNum)
If names(i) > names(i + 1) Then
temp = names(i)
names(i) = names(i + 1)
names(i + 1) = temp
End If
Next i
Next passNum
End Sub
Sub display(i As Integer, num_names As Long)'DISPLAYS NAME BACK ON EXCEL FILE In COLUMN 2'
For i = 1 To num_names
Cells(i, 2) = names(i)
Next i
End Sub