如何操作ReDim保留多维数组ID?

时间:2017-07-28 15:00:07

标签: vba excel-vba excel

我有一个问题,多维数组试图将日历层次结构中的组成员组合的ID(年 - >超级季节 - >季度 - >月 - >周)。问题是在特定周内要更改的周的ID号之一。比如根据屏幕截图,如果本周到来,ID /索引应该增加1

需要更改ID的条目

entry which need to change the ID

我必须为此问题修改的代码如下

Public Function writeStructure(intdimension As Integer) As Boolean
Dim objGroup As Variant
Dim objMember As Variant
Dim strError As String
Dim i As Integer
Dim j As Integer

    On Error GoTo ErrorRoutine

    writeStructure = False

    'write structure
        strError = "writing structure to " & readIniFileString("Dimensions", "Name" & intdimension, strControlFileIni)
        With Worksheets(readIniFileString("Dimensions", "Name" & intdimension, strControlFileIni))
            .Cells.Clear
            i = 1
            For Each objGroup In objGroups.Items
                .Cells(i, 1).Value = objGroup.Number
                .Cells(i, 2).Value = objGroup.Name
                i = i + 1
            Next

            i = 1
            For Each objMember In objMembers.Items
                .Cells(i, 3).Value = objMember.Number
                .Cells(i, 4).Value = objMember.Name
                .Cells(i, 5).Value = objMember.Description
                .Cells(i, 6).Value = objMember.Group
                .Cells(i, 7).Value = objMember.groupName
                For j = 1 To objMember.countOfParents
                    .Cells(i, 7 + j).Value = objMember.Parent(j) ' ID values are assigning
                Next j
                i = i + 1
            Next
        End With

0 个答案:

没有答案