返回列表 上一主題 發帖

[發問] 輸入順序?

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
     If .Count > 1 Or .Row = 1 Then Exit Sub
     If .Column = 2 Then
        If .Value = "" Then .Cells(1, 0).Resize(1, 6).ClearContents: Exit Sub
        .Cells(1, 0) = Format(Date, "emmdd")
     ElseIf .Column = 6 Then
        If .Value <> "" Then Range("B" & .Row + 1).Select
     End If
End With
End Sub
EXCEL參考資料:
http://blog.xuite.net/smile1000mile/blog

TOP

回復 3# s7659109


Private Sub Worksheet_Change(ByVal Target As Range)
With Target
     If .Count > 1 Or .Row = 1 Then Exit Sub
     If .Column = 2 Then
        If .Value = "" Then .Cells(1, 0).Resize(1, 6).ClearContents: Exit Sub
        .Cells(1, 0) = Format(Date, "emmdd")
     ElseIf .Column = 3 Then
        If .Value <> "" Then .Cells(1, 3).Select
     ElseIf .Column = 6 Then
        If .Value <> "" Then Range("B" & .Row + 1).Select
     End If
End With
End Sub
EXCEL參考資料:
http://blog.xuite.net/smile1000mile/blog

TOP

一般輸入資料是由左而右, 按ENTER後, 是往右跳的, 在功能表設定即可
EXCEL參考資料:
http://blog.xuite.net/smile1000mile/blog

TOP

回復 8# s7659109


Private Sub Worksheet_Change(ByVal Target As Range)
With Target
     If .Count > 1 Or .Row = 1 Then Exit Sub
     If .Column = 5 Then
        If .Value = "" Then .Cells(1, -3).Resize(1, 6).ClearContents: Exit Sub
        .Cells(1, -3) = Format(Date, "emmdd")
        .Cells(1, -2) = 123
        .Cells(1, -1) = 345
        .Cells(1, 2).Select
     ElseIf .Column = 6 Then
        If .Value <> "" Then .Cells(2, 0).Select
     End If
End With
End Sub
EXCEL參考資料:
http://blog.xuite.net/smile1000mile/blog

TOP

        靜思自在 : 難行能行,難捨能捨,難為能為,才能昇華自我的人格。
返回列表 上一主題