excel - Excel VBA插入行加上复制最后一行公式
问题描述
下面的公式只是插入行并更改某些偏移量的颜色。我需要从以前的单元格 H、M、N 中复制公式。有什么想法吗?
Sub button()
LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row
Range("D" & LastRow + 1).EntireRow.Insert
With Range("D" & Rows.Count).End(xlUp).Offset(1)
.Value = .Offset(-1).Value + 1
.Offset(, -1).Interior.ColorIndex = 0
.Offset(, -2).Interior.ColorIndex = 0
.Offset(, -3).Interior.ColorIndex = 0
End With
End Sub
解决方案
所以现在它正在工作
子 Prideti_produkta()
LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row
Range("D" & LastRow + 1).EntireRow.Insert
Range("H" & LastRow + 1).FillDown
Range("K" & LastRow + 1).FillDown
Range("M" & LastRow + 1).FillDown
Range("N" & LastRow + 1).FillDown
With Range("D" & Rows.Count).End(xlUp).Offset(1)
.Value = .Offset(-1).Value + 1
.Offset(, -1).Interior.ColorIndex = 0
.Offset(, -2).Interior.ColorIndex = 0
.Offset(, -3).Interior.ColorIndex = 0
End With
End Sub
推荐阅读
- angular - PrimeNG 烤面包机未显示 - Angular 6
- java - 为什么 Scanner 在读取文件时不转到下一行?
- c# - 在 nunit3 中忽略了测试超时
- python - 在 XML 文件中搜索字符串并在菜单树中打印位置 - Python
- python - 包含编号和名称排序的列表
- vba - VBA最小值和表格
- visual-studio-code - 如何在 Visual Studio 代码中按源列出快捷方式?
- android - 水平 RecyclerView 的 ItemTouchHelper
- javascript - 如何使 EXT JS 模型和代理商店工作?(请帮忙!)
- amazon-web-services - 如何从控制台获取 aws apigateway 中 api 的部署 ID?