|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下。。。。
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$CC$1" Then
arr = Range("CC3:CC" & [CC65536].End(3).Row)
ReDim brr(1 To UBound(arr), 1 To 1)
For i = 1 To UBound(arr)
If IsNumeric(arr(i, 1)) Then
If arr(i, 1) = "" Then
brr(i, 1) = Empty
Else
If i = 1 Then
brr(i, 1) = 1
Else
brr(i, 1) = brr(i - 1, 1) + 1
End If
End If
Else
brr(i, 1) = 0
End If
Next
For j = UBound(brr) - 1 To 1 Step -1
If brr(j, 1) > 0 And brr(j + 1, 1) > 0 Then brr(j, 1) = brr(j + 1, 1)
Next
Range("cg3:cg65").ClearContents
Range("cg3").Resize(UBound(arr), 1) = brr
End If
End Sub
|
评分
-
1
查看全部评分
-
|