在Excel中,你可以检查一个范围是否是整行

标题基本上是这么说的。

我想知道是否有这样的说法

if (Range1 contains all columns) then do stuff 

我想知道这一点,因为我需要一个子进行裁剪和插入行时,我有其他代码运行,当它不是整行。

布鲁斯·韦恩的build议似乎是合乎逻辑的。 您也可以检查yourRange.EntireRow.Address是否与整个行地址相同:

 yourRange.EntireRow.Address = Range(yourRange.Cells(1, 1), yourRange.Cells(1, yourRange.Columns.Count)).Address