1

一部のセルのフォーマットされた内容を数式で連結しようとしています。
純粋な式でそれを解決する方法がわからないので、いくつかの基本的なコードを追加します。

しかし、単一のセルからフォーマットされたテキスト値にアクセスする方法を理解できません。
oCellはセルオブジェクトではなく、セルコンテンツのみのようです。

これを変更するにはどうすればよいですか。oCell.TextやoCell.Stringなどを使用できます...

Function StringSumme(oCellRange )
    dim result as String
    dim nRow as Integer

    result = ""
   For nRow = LBound( oCellRange, 1) To UBound( oCellRange, 1 )
        For nCol = LBound( oCellRange, 2) To UBound( oCellRange, 2 )
            oCell=oCellRange(nRow,1)
            result = result + oCell
        Next 
    Next 
    StringSumme = result 
End Function

Excelではこれは機能します

Function StringSumme(bezug As Range) As String
    Dim txt As String
    Dim ce As Range

    txt = ""
    For Each ce In bezug.Cells
        txt = txt & ce.Text
    Next
    StringSumme = txt
End Function
4

1 に答える 1

1

ジェブ

私はあなたの質問を今理解していると思います。

これを入力すると

Function StringSumme(oCellRange)

oCellRangeは範囲ではありません。渡されている配列です。したがって、oCellはセルオブジェクトではなく、ご想像のとおり、セルのコンテンツのみです。

あなたはそれを次のようなものに変更したいかもしれません

oCell = Sheet.getCellByPosition(X、Y)

次に、oCell.Valueを使用します

興味深い読み物

http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/Cells_and_Ranges

于 2012-02-24T06:49:10.100 に答える