Reputation: 1
I have a very basic knowledge of VBA coding and am in dire need of some help.
I want to insert an empty cell every nth row in my data set.
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.
Upvotes: 0
Views: 1069
Reputation: 7567
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
Upvotes: 1