- 帖子
- 455
- 主題
- 111
- 精華
- 0
- 積分
- 563
- 點名
- 184
- 作業系統
- Windows 10
- 軟體版本
- Office 2019
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2013-11-7
- 最後登錄
- 2026-10-11
         
|
4#
發表於 2018-7-7 08:04
| 只看該作者
回復 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 |
|