Reputation: 175
I have a lot of cells separated by 3 rows each, and in those 3 rows I have to insert some words. Say, Distance, Centroid and Wind Velocity. Does any one know how to do that in Excel VBA? I attach a picture to explain it better.
Thanks in advance!
Upvotes: 1
Views: 490
Reputation: 12353
Try below code
Sub InsertText()
Dim lastRow As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
If Cells(i, 3) <> "" Then
Cells(i + 1, 4) = "Distance"
Cells(i + 2, 4) = "Centroid"
Cells(i + 3, 4) = "Wind Velocity"
End If
Next
End Sub
Upvotes: 1