【发布时间】:2015-08-21 13:14:44
【问题描述】:
我有一个宏,我需要在其中选择范围R2:last row in sheet。但是,我工作表中的最后一行在 R 列中可能是空白的。目前我正在使用这个
Dim t As Range
Set t = Range("R2", Range("R1000").End(xlUp))
For Each Cell In t
If IsEmpty(Cell) Then
Cell.Activate
ActiveCell.Value = "To Be Picked Up"
End If
Next
但是,如果最后一行在 R 列中有空白,则它会被忽略。我希望使用列A 来拉取范围,因为最后一行数据总是有列A。比如,
Dim t As Range
Set t = Range("R2", Range("A1000").End(xlUp).ActiveCell.Offset(0, 17))
For Each Cell In t
If IsEmpty(Cell) Then
Cell.Activate
ActiveCell.Value = "To Be Picked Up"
End If
Next
看起来很简单,但我敢肯定我错过了一些愚蠢的东西。任何帮助或替代方法都会有所帮助,谢谢。
【问题讨论】: