[英]Excel VBA insert row plus copy last row formula
下面的公式只是插入行并更改某些偏移的颜色。 我需要从以前的单元格 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.