[英]VBA-excel inserting a new cell every nth row in a dataset
I have a very basic knowledge of VBA coding and am in dire need of some help. 我对VBA编码有非常基本的了解,非常需要帮助。
I want to insert an empty cell every nth row in my data set. 我想在数据集中的第n行插入一个空单元格。
I have found the following VBA which achieves a similar goal and i was wondering if anyone has an idea of tweaking the linked or have had a similar problem. 我发现以下实现类似目标的VBA,我想知道是否有人想调整链接或有类似问题。
VBA Excel: Insert a new column every nth column filled with a formula which refrences the immediate column to the left VBA Excel:每第n列插入一个新列,该列中填充了一个公式,该公式将立即数列向左
Use union method. 使用联合方法。
Sub insertRow()
Dim rngU As Range, rng As Range
Dim i As Long
For i = 4 To 20 Step 3
If rngU Is Nothing Then
Set rngU = Range("a" & i)
Else
Set rngU = Union(rngU, Range("a" & i))
End If
Next i
rngU.EntireRow.Insert
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.