[英]SpecialCells returns different results depending on size of range
i really confuse and curious, why with same coding, just with different data quantity, the output can be really different? 我真的很困惑和好奇,为什么相同的编码,只是不同的数据量,输出可能真的不同?
With Sheets("control deck").Range("A2:A5000").SpecialCells(xlCellTypeBlanks)
.FormulaR1C1 = "=r[-1]C"
End With
with 同
With Sheets("control deck").Range("A2:A50000").SpecialCells(xlCellTypeBlanks)
.FormulaR1C1 = "=r[-1]C"
End With
the first output, fill only the blanks with the copy of cell's value above and the second coding, fill all the range with copy of first cell's value 第一个输出, 只填充空格和上面的单元格值的副本和第二个编码,用第一个单元格值的副本填充所有范围
my data : 我的数据:
> 1111 | abc |x
> |y
> |z
>
> 1112 | def |R
> |S
> |T
> |U
what i hope come out 我希望得到什么
1111 | abc |x 1111 abc |y 1111 abc |z 1112 | def |R 1112 def |S 1112 def |T 1112 def |U
what came out 什么出来了
> 1111 | abc |x > 1111 abc |y > 1111 abc |z > > 1111 | abc |R > 1111 abc |S > 1111 abc |T > 1111 abc |U
anybody know why? 有谁知道为什么?
this only happen if the range above 30000 `row 只有在30000以上的行范围内才会发生这种情况
If you are using Excel 2007 or earlier, there is a limit to the number of distinct cell areas SpecialCells
can reference of 8192 如果您使用的是Excel 2007或更早版本,则
SpecialCells
可以参考8192的不同单元区域数量有限制
As an alternative, try this 作为替代方案,试试这个
Sub Demo()
Dim r As Range
Dim dat As Variant
Dim i As Long
Set r = Sheets("Sheet2").Range("A2:A50000")
dat = r.FormulaR1C1
For i = 1 To UBound(dat, 1)
If dat(i, 1) = "" Then
dat(i, 1) = "=r[-1]C"
End If
Next
r = dat
End Sub
This will be much faster, too. 这将是更快了。
特殊细胞中存在一个错误,据称于2010年修复,可以选择8,192个区域。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.