我有很多单元格,每行有3行,在这3行中我必须插入一些单词。说,距离,质心和风速。有没有人知道如何在Excel VBA中这样做?我附上一张图片来解释它。
提前致谢!
答案 0 :(得分:1)
尝试以下代码
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