如何使用Array在VBA中对数据进行分组?

时间:2018-06-19 09:13:46

标签: excel-vba vba excel

我有一组数据,我想使用array()或库,但我不太清楚如何处理这个问题来回答我的问题:

阅读2栏

第一数据表否(DS否) 第二个标签号

然后我想回答2个问题:1)哪个运行号码在同一组DS中有标签号? 2)DS No没有关联多少个标签?

以下是基本代码(此帖子缩写)

Sub IDScase()
Dim i as Integer
Dim counter as Interger
Dim tagno as string
Dim DSno as string
Dim Dim DSlib() As String
i = 0 ' running counter for the library

Do While ThisWorkbook.Sheets("query").Cells(counter, 2).Value <> 0 ' as long as there are values in table

tagno= ThisWorkbook.Sheets("query").Cells(counter, 6).Value ' reading the tag no
DSno = ThisWorkbook.Sheets("query").Cells(counter, 95).Value ' reading the DS no

        DSlib(i, 1) = DSno 'DS no in column 1
        DSlib(i, 2) = wsname 'tag no in colum 2

        NoTag = UBound(DSlib, 2) ' number of read in tag no
    counter = counter + 1
    i = i + 1

    Loop
End sub()

Question 1 read in Question2

0 个答案:

没有答案