在另一个单元格中输入数据后,转到特定单元格,然后进入选项 [英] Go To A Particular Cell After Inputting Data In Another Cell And Hitting Enter Options

查看:134
本文介绍了在另一个单元格中输入数据后,转到特定单元格,然后进入选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Excel表格,我在A2,B2和C2中输入数据;在我输入后,我想要光标选择下一行,所以我可以输入A3,B3和C3等信息



我发现这个信息

  Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range(C2)。Value< 然后
Range(A3)。选择
End If
End Sub

但它只能工作一次,我如何重复这个过程一遍又一遍

感谢您的帮助.....

解决方案

另一种方式。


  1. 在Col A中,选择将移至Col B.

  2. 如果您在Col B的任何地方输入,选择将移至Col C。

  3. 如果您在Col C的任何地方输入,选择将返回到Col A(下一行)。

strong>:这在相关的表格代码区域。

  Private Sub Worksheet_Change(ByVal Target As Range)
On错误GoTo Whoa

Application.EnableEvents = False

如果没有Target.Cells.CountLarge> 1然后
如果不相交(目标,列(1))没有,然后
Target.Offset(,1)。选择
ElseIf不相交(目标,列(2))不是然后
Target.Offset(,1).Select
ElseIf Not Intersect(Target,Columns(3))Is Nothing Then
Target.Offset(1,-2).Select
结束如果
结束如果
Letscontinue:
Application.EnableEvents = True
退出子
哇:
MsgBox Err.Description
Resume Letscontinue
End Sub

ScreenShot




I have a Excel sheet and I'm inputting data in A2, B2 and C2; after I hit enter I want the cursor select the next line so I can input information on A3, B3 and C3 and so on

I found this information

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("C2").Value <> "" Then
Range("A3").Select
End If
End Sub

But it only works one time, how can I repeat this process over and over

Thanks for your help.....

解决方案

Another way.

  1. If you type anywhere in Col A, the selection will move to Col B.
  2. If you type anywhere in Col B, the selection will move to Col C.
  3. If you type anywhere in Col C, the selection will move back to Col A (Next Line).

Code: This goes in the relevant sheet code area.

Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo Whoa

    Application.EnableEvents = False

    If Not Target.Cells.CountLarge > 1 Then
        If Not Intersect(Target, Columns(1)) Is Nothing Then
            Target.Offset(, 1).Select
        ElseIf Not Intersect(Target, Columns(2)) Is Nothing Then
            Target.Offset(, 1).Select
        ElseIf Not Intersect(Target, Columns(3)) Is Nothing Then
            Target.Offset(1, -2).Select
        End If
    End If
Letscontinue:
    Application.EnableEvents = True
    Exit Sub
Whoa:
    MsgBox Err.Description
    Resume Letscontinue
End Sub

ScreenShot

这篇关于在另一个单元格中输入数据后,转到特定单元格,然后进入选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆