如:A列只有1,3,4,5行非空,所以在B列给1,3,4,5行赋值“hello”
A列 B列
1 hello
3 hello
4 hello
5 hello
如:A列只有1,3,4,5行非空,所以在B列给1,3,4,5行赋值“hello”
A列 B列
1 hello
3 hello
4 hello
5 hello
如果答案对你有帮助,请采纳下
Sub hello()
r = ThisWorkbook.Sheets(1).Range("A65535").End(xlUp).Row
For i = 1 To r
With ThisWorkbook.Sheets(1)
If .Cells(i, 1) <> "" Then
.Cells(i, 2) = "hello"
End If
End With
Next
End Sub