|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下。。。
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$Z$1" Then
arr = [m14:y105]
ReDim brr(1 To UBound(arr) - 1, 1 To UBound(arr, 2))
For j = 1 To UBound(arr, 2)
t = False: n = 0
For i = 1 To UBound(arr)
If arr(i, j) = 0 Then
n = n + 1
If t = True Then brr(i - 1, j) = arr(i - 1, j): t = False
Else
If n > 3 Then
t = True
End If
n = 0
End If
Next
Next
For i = 1 To UBound(brr) '此处为了填充0
For j = 1 To UBound(brr, 2)
If Len(brr(i, j)) = 0 Then brr(i, j) = 0
Next
Next
[aa14].Resize(UBound(brr), UBound(brr, 2)) = brr
Beep
End If
Application.EnableEvents = True
End Sub
|
评分
-
2
查看全部评分
-
|