[英]Set range as a single cell relative to active cell
当我尝试将范围定义为相对于当前单元格的单个单元格时,出现错误,提示该范围失败:
If target.Cells.Column = 2 Then
If target.Cells.Row > 3 Then
If target.Cells.Count = 1 Then
Range(ActiveCell.Offset(0, 1)).Select
End If
End If
End If
我知道我可以在当前单元格中创建范围,然后再偏移,但是我只想定义范围
Dim c As Range
If target.Cells.Count = 1 Then
If target.Row > 3 and target.Column = 2 Then
Set c = target.Offset(0, 1)
'do something with c
End If
End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.