|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
新版本进行了优化
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim dt As Date
If Target.CountLarge > 1 Then Exit Sub
If Target.Row + 1 And 1 Then [j4] = "": Exit Sub
Set Rng = Application.Intersect(Target, [b5:H15])
If Rng Is Nothing Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
myr = Sheets("记事表").Range("a65536").End(xlUp).Row + 1
If IsEmpty(arr) Then arr = Sheets("记事表").Range("a2:C" & myr).Value
Application.EnableEvents = False
If Len(Target) = 0 Then
[j4] = Chr(10) & " 暂无数据!"
ActiveSheet.Unprotect
Range("J4").Font.Color = -16776961
ActiveSheet.Protect
Else
dt = CDate(Target(0, 1))
For j = 2 To myr
If CDate(arr(j, 1)) = dt And arr(j, 2) = Target Then
[j4] = " " & Replace(arr(j, 3), "、", Chr(10) & " ")
ActiveSheet.Unprotect
Range("J4").Font.ColorIndex = xlAutomatic
ActiveSheet.Protect
Exit For
End If
Next j
End If
Application.EnableEvents = True
End Sub
|
评分
-
1
查看全部评分
-
|