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
If you are using Excel 2007 or earlier, there is a limit to the number of distinct cell areas SpecialCells
can reference of 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个区域。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.