|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Option Explicit
- Dim ar
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim i, r, n, c, arr, t
- Application.EnableEvents = False
- Application.ScreenUpdating = False
- c = Target.Column
- r = Target.Row
- n = Range("a60000").End(3).Row
- If c = 3 And r > 1 Then
- arr = Range("a2:c" & n)
- For i = 1 To n - 1
- If Target.Offset(0, -2).Value & "@" & ar = arr(i, 1) & "@" & arr(i, 3) Then
- Range("c" & i + 1) = Target.Value
- End If
- Next i
- End If
- [e1] = 4
- Application.ScreenUpdating = True
- Application.EnableEvents = True
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim c, r
- Application.EnableEvents = False
- Application.ScreenUpdating = False
- c = Target.Column
- r = Target.Row
- If c = 3 And r > 1 Then
- ar = Target.Value
- End If
- Application.ScreenUpdating = True
- Application.EnableEvents = True
- End Sub
复制代码 |
|