Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("P3")
If Not Application.Intersect(KeyCells, Range(Target.Address)) \_
Is Nothing Then
v = Range("Q3", Range("Q" & Rows.Count).End(xlUp)).Value
No of months e.g. 6 months or 1 year
Days = Range("P16").Value
With CreateObject("Scripting.Dictionary")
For Each c In v
.Item(c) = 1
Next c
Range("R3").Resize(.Count) = Application.Transpose(.Keys)
End With
MsgBox "Cell " & Target.Address & " has changed."
End If
End Sub
我已尝试过上述法典,以便在R栏上获得几个月的独特名称,因为你可以看到图像。
现在正试图从P栏中获取包括S类格式的年份在内的产出。
并且希望根据“P16”小组的价值,在“P3”投入日期的基础上增加28天。