答案1
以下代码绝对没有经过测试。您需要进行必要的研究才能修复我的错误。
Function InRange(Range1 As Range, Range2 As Range) As Boolean
' returns True if Range1 is within Range2
Dim InterSectRange As Range
Set InterSectRange = Application.Intersect(Range1, Range2)
InRange = Not InterSectRange Is Nothing
Set InterSectRange = Nothing
End Function
Private Sub Worksheet_Change(ByVal Target As Range)
Set Range1 = Range("C4:C25")
Set Range2 = Range("F4:F25")
Set Range3 = Range("I4:I10")
If InRange(Target.Address, Range1) OR InRange(Target.Address, Range2) OR InRange(Target.Address, Range3) Then
Range("I23").Value = Now
End If
End Sub