如何将以下代码粘贴到另一个工作表的列中,并按照从顶部开始到达的顺序粘贴值
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range, Dn As Range, n As Long
Dim RngB As Range, RngC As Range, Ray
If Target.Column = 2 And Target.Count = 1 And Target.Row > 1 Then
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
Set RngB = Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
Set RngC = Range(Range("C2"), Range("C" & Rows.Count).End(xlUp))
Ray = Array(RngB, RngC)
For n = 0 To 1
For Each Dn In Ray(n)
If Not Dn.Address(0, 0) = "C1" And Not Dn.Value = "" Then
.Item(Dn.Value) = Empty
End If
Next Dn
Next n
Range("C2").Resize(.Count) = Application.Transpose(.Keys)
End With
End If
If Target.Column = 2 Then
ActiveSheet.AutoFilter.ApplyFilter
End If
End Sub
进入B的值来自进入另一个单元格的公式,如果另一个Windows应用程序执行某些操作,则引用包含值的公式。尽管如此,我仍然不明白为什么不能调整上述内容以解决这个问题,因为即将发生的事情仍然是数字。