【发布时间】:2012-02-23 11:50:26
【问题描述】:
我尝试用公式连接一些单元格的格式化内容。
因为我看不到用纯公式解决它的方法,所以我添加了一些基本代码。
但我不知道如何从单个单元格中访问格式化的文本值。
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
【问题讨论】:
-
您是在 openoffice 还是在 excel 中寻找解决方案?
-
我正在寻找一个 openoffice 解决方案,我的 excel 解决方案有效
-
jeb,我不确定你的问题。您编写的 OO 代码可以完美运行,无需在 oCell 之后添加任何内容
-
但它只复制没有格式的文本。我有格式为“0”的单元格,OO 代码我丢失了
, -
+1 好问题。我今天学到了一些新东西,哈哈
标签: excel openoffice-calc openoffice-basic vba