Excel在工作表中放置集合值

时间:2017-08-16 18:54:27

标签: excel vba

目前我有一个包含一组不同字符串值的Collection。 有了这个Collection,我必须把它放在工作表上。 什么是现有的功能方法来放置每一行,从该行开始,该函数被称为集合中的值? 是否意味着正在调用函数的单元格,然后迭代地根据行偏移打印? 任何人都可以为这种情况提供任何指示吗?

完整的过程意味着以下输入:

0
0
0
TestString1.c
TestString2.h
TestString1.c, TestString2.h
0
0
xmlString
0

从此创建具有不同标记的集合,不同于0。

(问题从这里开始) 所需的输出是打印

TestString1.c
TestString2.h
xmlString

在单元格的每一行上都有一个函数被调用。

当前开发的代码:

Public Function BuildData(originRange As range)
Dim uniques As Collection
Dim source As range
Set source = originRange
Set uniques = GetUniqueValues(source.Value)

Dim currentRow As Integer
Dim currentColumn As Integer
currentRow = ActiveCell.Row
currentColumn = ActiveCell.Column

Dim pivot As Integer
For pivot = 0 To uniques.Count
    Cells(currentRow + pivot, currentColumn).Value = uniques.Item(pivot + 1)
Next pivot
End Function

解决方案:

解决方案是从功能切换到子。

0 个答案:

没有答案