I have a two Input data of Year and Name in separate two arrays. I need to sort both the array values first i need to sort it chronologically(Year) and then if year information repeats it will sort the Array Alphabetically.
As for as i complete the sorting for both year and then name. Using Wordbasic.sortarray command
Input: (Before sorting)
Output: (After sorting)
if i print it in word it printed like this:
PJK 1983, ELS 1986, EFD 1986, WKL 1995, SDF 1997.
Here is my code for Printing the data. Would anyone please look into this and guide me where did i made mistake?
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim N As Integer
Dim Counter As Integer '
COUNTER1 = 1
i1 = 1
J1 = 5
For I = 0 To UBound(SortyearArray())
Counter = 1
For J = I + 1 To UBound(SortyearArray())
If SortyearArray(I) = SortyearArray(J) Then
Counter = Counter + 1
COUNTER1 = Counter + COUNTER1
If Counter = 1 Then
For N = i1 To J1
If SortyearArray(I) = Year(N) Then
Selection.TypeText Text:="(" & AuthorName(N) & Year(N) & ")"
Anyone please guide me to complete this.