更新时间2022-07-06 17:23:12
哪位高手可以帮我写一段代码,VBA复制区域数值粘贴到筛选后的可见单元格
平常输入数据时,就多按一下回车键(如下图所示)。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim arr(), k%, n%, m%, dhk
dhk = MsgBox("不是粘贴数值到可见单元格吗?", vbYesNo)
If dhk = 6 Then Exit Sub
***.enableevents = False
k = selection.***.count
ReDim arr(1 To k)
n = 0
For Each y In Selection
n = n + 1
arr(n) = y
Next y
m = 0
For Each y In ***.resize(12345)
If m = k Then Exit For
If ***.height <> 0 Then
m = m + 1
***.value = arr(m)
Else
***.clearcontents
End If
Next y
***.enableevents = True
End Sub