返回列表 上一主題 發帖

[發問] 如何避開按Enter後自動移動的設定

回復 2# GBKEE
版主早安
請教一下我依照您的語法改了一下,想請教是否可以簡化
B10~F10
.
.
.
B23~F23





Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    With Target
   
        If Not Application.Intersect(.Cells(1), Range("B10:D10")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B11:D11")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B12:D12")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B13:D13")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B14:D14")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B15:D15")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B16:D16")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B17:D17")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
               
        If Not Application.Intersect(.Cells(1), Range("B18:D18")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B19:D19")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B20:D20")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B21:D21")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        If Not Application.Intersect(.Cells(1), Range("B22:D22")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
               
        If Not Application.Intersect(.Cells(1), Range("B23:D23")) Is Nothing Then
            .Cells(1).Offset(0, 2).Select
        End If
        
        
        
        
    End With
End Sub
Just do it.

TOP

        靜思自在 : 做該做的事是智慧,做不該做的事是愚癡。
返回列表 上一主題