【发布时间】:2021-06-02 07:53:19
【问题描述】:
界面如下:
帐户:威塞克斯银行有限公司
收入:200 欧元
费用:
日期:28.02.2021
输出应该是下面单元格中的列表:
日期: |帐户: |收入:|费用:|
28.02.2021 |威塞克斯银行 | 200 欧元 |
2021 年 2 月 28 日 |食品 | - | 175 欧元 |
提示:我想要一份包含 5-7 次预订的清单以及时间
进行新预订 最新预订将位于顶部位置,第一个预订位于最后一行,例如当表格从第 13 行开始并且我使用不同帐户进行 5 次预订时,第一个预订将在第 17 行结束。
这是复制表格中的内容
Sub MyBuchenMakro
Dim currDoc As Object
Dim currSheet As Object
Dim curr Cell As Object
Dim destCell As Object
Dim oDate As Date
Dim einnahmen As Currency
Dim ausgaben As Currency
currDoc = ThisComponent
currSheet = currDoc.sheets(0)
currCell = currSheet.getCellByPosition(1, 5)
destCell = currSheet.getCellByPosition(1, 12)
destCell.String = currCell.String
currCell = currSheet.getCellByPosition(1, 6)
destCell = currSheet.getCellByPosition(2, 12)
destCell.setValue(CCur(currCell.getValue()))
currCell = currSheet.getCellByPosition(1, 7)
destCell = currSheet.getCellByPosition(3, 12)
destCell.setValue(CCur(currCell.getValue()))
currCell = currSheet.getCellByPosition(1, 8)
destCell = currSheet.getCellByPosition(0, 12)
destCell.setValue(CDate(currCell.getValue()))
For i = 160 To 13 Step 1
destCell = currSheet.getCellByPosition(0, i)
If destCell == "" Then
GoTo Continue
End if
destCell = currSheet.getCellByPosition(0,i+1)
destCell.setValue(CDate(currCell.getValue()))
currCell = currSheet.getCellByPosition(1,i)
destCell = currSheet.getCellByPosition(1,i+1)
destCell.String = currCell.String
currCell = currSheet.getCellByPosition(2,i)
destCell = currSheet.getCellByPosition(2,i+1)
destCell.setValue(CCur(currCell.getValue()))
currCell = currSheet.getCellByPosition(3,i)
destCell = currSheet.getCellByPosition(3,i+1)
destCell.setValue(CCur(currCell.getValue()))
Next i
End Sub
[1]: https://i.stack.imgur.com/Mw7pJ.png
【问题讨论】:
-
已完成编辑,希望对您有所帮助
-
欢迎您!据我了解您的代码,第 12 行已经填充了标题“日期:| 帐户:| 收入:| 成本:|”?整个任务归结为在已经填写的表格中查找预订日期不大于在“输入表单”日期字段中输入的日期的行,在此位置插入新行并将四个输入字段的值传输到这个新行,不是吗?
-
第 12 行将是表格的标题。我也想将日期添加到表格中。我不会将日期与某事进行比较。
标签: libreoffice libreoffice-basic openoffice-basic