|
楼主 |
发表于 2021-2-27 14:54
|
显示全部楼层
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim r%
Cancel = True
If Target.Row >= 3 And Target.Column >= 7 And Target.Column <= 11 Then 如果我是从第四行,第6列开始使用这个触发键,那么我就改写成If Target.Row >= 4 And Target.Column >= 6 And Target.Column <= 11 Then这样子没错吧?下面也是同理?
r = 4
Do While 1
If Cells(r, "T") = "" Then
Exit Do
ElseIf Cells(r, "T") = Cells(2, Target.Column) Then
Target = Cells(r, "U")这段话是不是指数据查询表所在第几行,哪一列读取的意思吗?
Exit Do
End If
r = r + 1
Loop
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r%
If Target.Row >= 3 And Target.Column >= 12 And Target.Column <= 14 Then
Application.EnableEvents = False
Application.ScreenUpdating = False
r = 4
Do While 1
If Cells(r, "T") = "" Then
Exit Do
ElseIf Cells(r, "T") = Cells(2, Target.Column) Then
If Val(Target.Value) = 1 Then
Target = Cells(r, "U")
ElseIf Val(Target.Value) = 2 Then
Target = Cells(r, "V")
End If
Exit Do
End If
r = r + 1
Loop
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub |
|