Excel宏在循环中粘贴值

时间:2016-02-28 07:22:19

标签: excel vba loops

当值为空时,我想创建一个循环以在列N中粘贴“在线”。这可能吗?

1 个答案:

答案 0 :(得分:1)

试试这段代码。我假设您知道N列中的最后一行,否则您将不得不将其更改为do-while循环

Sub LoopN()
Dim i As Long
Dim n As Long
n = cells(rows.count, "N").end(xlup).row
For i = 1 To n
If Cells(i, 14).Value = "" Then Cells(i, 14).Value = "online"
Next i
End Sub