如何将table中的数据记录转化为table的结果,并显示为带有总和的摘要?
How to get data records from a table into a result table and is displayed as summary with a total sum?
我有一个名为“Table”的 table,其中有一个带有价格的项目列表 - 当按下一个按钮时,我想将所有数据传输到另一个结果 Table 在同一个工作簿中,您可以在其中列出数据库中的所有项目和列表中的项目,并以 =Sum Function
的形式给出收入和成本的差异
它在 Excel 中工作得很好,但我想要一个用于 Libre office calc 的宏,这样我也可以在 Libre Office 中做同样的事情。
提示:我上传了 2 张原样和目标状态的屏幕截图
如果您需要更多代码,我可以为您编辑 post
Table 数据在另一个结果中查看 table
结果table
这应该对你有帮助:
Sheets("Matrix").Select
Range("C3").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Aufstellung!R13C2:R[997]C;Matrix!RC[-1];Aufstellung!R13C3:R[997]C)"
Range("C3").Select
Selection.AutoFill Destination:=Range("C3:C42"), Type:=xlFillDefault
Range("C3:C42").Select
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("D3").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Aufstellung!R13C2:R[997]C;Matrix!RC[-2];Aufstellung!R13C4:R[997]C)"
Range("D3").Select
Selection.AutoFill Destination:=Range("D3:D42"), Type:=xlFillDefault
Range("D3:D42").Select
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("B3:D42").Select
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Selection.Copy
Range("F3:H42").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I3:I42").Select
Application.CutCopyMode = False
' ActiveWorkbook.Worksheets("Matrix").Sort.SortFields.Clear
' ActiveWorkbook.Worksheets("Matrix").Sort.SortFields.Add Key:=Range("I3"), _
' SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
' With ActiveWorkbook.Worksheets("Matrix").Sort
' .SetRange Range("F3:I42")
' .Header = xlNo
' .MatchCase = False
' .Orientation = xlTopToBottom
' .SortMethod = xlPinYin
' .Apply
' End With
Call SortMatrix_FI()
Range("F3:I42").Select
Selection.Copy
Sheets("Kassenblatt").Select
Range("C6:F45").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=IF(RC[4]>0;R[-1]C+1;"""")"
Range("B6").Select
Selection.AutoFill Destination:=Range("B6:B45"), Type:=xlFillDefault
Range("B6:B45").Select
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("A6").Select
ActiveCell.FormulaR1C1 = "=IF(RC[5]>0;R1C4;"""")"
Range("A6").Select
Selection.AutoFill Destination:=Range("A6:A45"), Type:=xlFillDefault
Range("A6:A45").Select
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("I5").Select```
我有一个名为“Table”的 table,其中有一个带有价格的项目列表 - 当按下一个按钮时,我想将所有数据传输到另一个结果 Table 在同一个工作簿中,您可以在其中列出数据库中的所有项目和列表中的项目,并以 =Sum Function
它在 Excel 中工作得很好,但我想要一个用于 Libre office calc 的宏,这样我也可以在 Libre Office 中做同样的事情。
提示:我上传了 2 张原样和目标状态的屏幕截图
如果您需要更多代码,我可以为您编辑 post
Table 数据在另一个结果中查看 table
结果table
这应该对你有帮助:
Sheets("Matrix").Select
Range("C3").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Aufstellung!R13C2:R[997]C;Matrix!RC[-1];Aufstellung!R13C3:R[997]C)"
Range("C3").Select
Selection.AutoFill Destination:=Range("C3:C42"), Type:=xlFillDefault
Range("C3:C42").Select
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("D3").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Aufstellung!R13C2:R[997]C;Matrix!RC[-2];Aufstellung!R13C4:R[997]C)"
Range("D3").Select
Selection.AutoFill Destination:=Range("D3:D42"), Type:=xlFillDefault
Range("D3:D42").Select
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("B3:D42").Select
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Selection.Copy
Range("F3:H42").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I3:I42").Select
Application.CutCopyMode = False
' ActiveWorkbook.Worksheets("Matrix").Sort.SortFields.Clear
' ActiveWorkbook.Worksheets("Matrix").Sort.SortFields.Add Key:=Range("I3"), _
' SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
' With ActiveWorkbook.Worksheets("Matrix").Sort
' .SetRange Range("F3:I42")
' .Header = xlNo
' .MatchCase = False
' .Orientation = xlTopToBottom
' .SortMethod = xlPinYin
' .Apply
' End With
Call SortMatrix_FI()
Range("F3:I42").Select
Selection.Copy
Sheets("Kassenblatt").Select
Range("C6:F45").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=IF(RC[4]>0;R[-1]C+1;"""")"
Range("B6").Select
Selection.AutoFill Destination:=Range("B6:B45"), Type:=xlFillDefault
Range("B6:B45").Select
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("A6").Select
ActiveCell.FormulaR1C1 = "=IF(RC[5]>0;R1C4;"""")"
Range("A6").Select
Selection.AutoFill Destination:=Range("A6:A45"), Type:=xlFillDefault
Range("A6:A45").Select
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Range("I5").Select```