如何在VBA字中打印两个排序的数组? [英] How to Print the Two sorted array in VBA word?
问题描述
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
仅打印(名称和年份)不正确。有没有人可以研究这个?
< blockquote>
收获,
对不起你,但这不是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 information
Array(0) = (Deepak) 1987
Array(1) = (G.Lakshmi) 1985
Array(2) = (U.Dev) 1988
Array(3) = (G.Kannan) 1985
Array(4) = (D.Dhana) 1988
I sorted this array Chronologically
Code:
WordBasic.SortArray Array()
So that i Got the values:
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
Again i have to sort this array values alphabetically So that i need to print this values
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
Code:
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 having the value of LBArray and J1 the value of UBArray For II = 0 To UBound(SortArray()) Counter = 1 For JJ = II + 1 To UBound(SortArray()) If SortArray(II) = SortArray(JJ) Then Counter = Counter + 1 MsgBox (Counter) End IfNext JJ If Counter = 1 Then For N = i1 To J1 If SortArray(II) = Array(N) Then Selection.TypeText Text:="(" & Authorname(N) & Array(N) & ")"End IfNext NEnd IfII = II + CounterNext II
It 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 quick
http://social.msdn.microsoft.com/Forums/en-US/isvvba/threads
这篇关于如何在VBA字中打印两个排序的数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!