在OOo Calc中
我需要使用分配给按钮的宏将一列(仅值,而不是格式)从一张工作表复制到另一张工作表(在同一工作表中)。
我浏览了一下但没有发现任何重要的事情: - (
答案 0 :(得分:1)
好的,我可以建立答案并开始学习OOo Basic,我设法避免到现在为止; - )
我按原样给出。
Sub UpdateThisWeek
Dim Doc As Object
Dim ThisWeek As Object
Dim Steering As Object
Dim Source As Object
Dim Target As Object
Dim Week as Integer
Doc = ThisComponent
ThisWeek = Doc.Sheets.getByName("This week")
Steering = Doc.Sheets.getByName("Steering")
Week = Steering.getCellByPosition(6,4).Value
Source = ThisWeek.getCellRangeByName("H12:H206")
Target = Steering.getCellRangeByName("M12:AU206").getCellRangeByPosition(Week-19,0,Week-19,194)
Dim i, s
For i = 0 To 194
s = Source.getCellByPosition(0, i).Value
If s > 0 Then
Target.getCellByPosition(0, i).Value = s
Else
Target.getCellByPosition(0, i).String = ""
End If
Next i
End Sub
答案 1 :(得分:1)
回答原来的问题:
使用数据数组,在大范围的单元格上显着更快
Source = ThisWeek.getCellRangeByName("H12:H206")
source_data = Source.getDataArray()
Target = Steering.getCellRangeByName("M12:AU206").setDataArray(source_data())