首页 > 解决方案 > 工作日的 split 函数产生 1 或 0

问题描述

我有一个简单的电子表格,其中包含会议名称、组织者、星期几、开始时间和公司会议的长度。我正在使用拆分函数将星期几放入数组中。我确定 c 列是日期列表的正确列。但我无法弄清楚为什么拆分功能无法正常工作。我将把类对象的代码放在底部。一如既往,任何帮助将不胜感激。代码如下。

Sub ExportToPPT()

'creates a new object for each BRE day/time combination
count = 0
For Each i In BREitems
    BREdaysString = Split(Cells(i.Row, "c").value, ",")          'This is where the split happens
    For j = 1 To UBound(BREdaysString)

        count = count + 1
        ReDim Preserve BREobjects(count)
        Set BREobjects(count) = New BREpptObjects

        With BREobjects(count)
            .BREname = Cells(i.Row, "a").value
            .BREcategory = Cells(i.Row, "b").value
            .BREdays = BREdaysString(j)                        'this is where the day is assigned to the object's property. This is a 1 or 0 currently. IDK why.
            .BREstartTime = Cells(i.Row, "d").value
            .BRElength = Cells(i.Row, "e").value
            .BREtimeRight = Right(Cells(i.Row, "d").value, 2)
        End With
    Next j
    Erase BREdaysString
Next i

for i = 1 to UBound(BREobjects)
    debug.print BREObjects(i).BREID
next i
.
.
.
'more code that does stuff....

标签: excelvba

解决方案


推荐阅读