本文介绍了如何在VBA字中打印两个排序的数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 HELLO, 我为这个问题奋斗了两天。在这里,我解释并给出我的代码。请有人查看此内容并帮我解决。 要求: 我有数组()仅具有年份信息的值 数组(0)=(迪帕克)1987年数组(1)=(G.Lakshmi)1985 数组(2)=(U.Dev)1988 数组(3)=(G.Kannan)1985 $ 数组(4)= (D.Dhana)1988 $ 我按时间顺序排列了这个数组 代码: WordBasic.SortArray Array() 因此我得到了值:  Sortarray(0)=(G Lakshmi)1985年 Sortarray(1)=(G.Kannan)1985年 Sortarray(2)=(G.Deepak)1987年$ Sortarray (3)=(U.Dev)1988 Sortarray(4)=(D.Dhana)1988 $ 我必须再排序此数组值按字母顺序排列因此我需要打印此值  $ Sortarray1(0)=(G.Kannan)1985 Sortarray1(1)=(G.Lakshmi)1985 $ Sortarray1(2)=(G.Deepak)1987 $ Sortarray1(3)=( D.Dhana)1988年 Sortarray1(4)=(G.Dev)1988年 $ 代码: Dim i1 as integer Dim j1 as integer Dim II As Integer Dim JJ As Integer Dim KK As Integer Dim N As Integer Dim Counter As Integer i1的值为LBArray,J1的值为UBArray For II = 0 To UBound(SortArray()) Counter = 1 For JJ = II + 1 To UBound(SortArray())如果SortArray(II)= SortArray (JJ)然后 Counter = Counter + 1 MsgBox(Counter) End IfNext JJ If Counter = 1 Then For N = i1 To J1 如果SortArray(II)= Array(N)则 Selection.TypeText Text:="(" &安培; Authorname(N)&阵列(N)& ")" End IfNext NEnd IfII = II + CounterNext II 仅打印(名称和年份)不正确。有没有人可以研究这个? 解决方案 收获, 对不起你,但这不是VBA论坛,幸运的是有一个VBA论坛,大多数答案都是非常快的 http://social.msdn.microsoft.com/Forums/en- US / isvvba /线程 HELLO,I struggle up for last two days for this issue. Here i explained it and give my code. Please anyone look into this and help me to resolve.Requirements:I have Array() values having only Year informationArray(0) = (Deepak) 1987Array(1) = (G.Lakshmi) 1985Array(2) = (U.Dev) 1988Array(3) = (G.Kannan) 1985Array(4) = (D.Dhana) 1988I sorted this array ChronologicallyCode:WordBasic.SortArray Array()So that i Got the values: Sortarray(0) = (G.Lakshmi) 1985Sortarray(1) = (G.Kannan) 1985Sortarray(2) = (G.Deepak) 1987Sortarray(3) = (U.Dev) 1988Sortarray(4) = (D.Dhana) 1988Again i have to sort this array values alphabetically So that i need to print this values Sortarray1(0) = (G.Kannan) 1985Sortarray1(1) = (G.Lakshmi) 1985Sortarray1(2) = (G.Deepak) 1987Sortarray1(3) = (D.Dhana) 1988Sortarray1(4) = (G.Dev) 1988Code:Dim i1 as integerDim j1 as integerDim II As IntegerDim JJ As IntegerDim KK As IntegerDim N As IntegerDim Counter As Integeri1 having the value of LBArray and J1 the value of UBArrayFor II = 0 To UBound(SortArray())Counter = 1For JJ = II + 1 To UBound(SortArray())If SortArray(II) = SortArray(JJ) ThenCounter = Counter + 1MsgBox (Counter)End IfNext JJIf Counter = 1 ThenFor N = i1 To J1If SortArray(II) = Array(N) ThenSelection.TypeText Text:="(" & Authorname(N) & Array(N) & ")"End IfNext NEnd IfII = II + CounterNext IIIt print only the (Name and Year) improperly. Did Anyone can look into this? 解决方案 Harvest,Sorry for you but this is not the VBA forum, Luckily for you there is a VBA forum and mostly answers are there given very quickhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/threads 这篇关于如何在VBA字中打印两个排序的数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 11:49