提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中设置单元格或解锁单元格的Tab键顺序?

假设您需要为您自己定义的选项卡顺序(例如,从单元格B5到C6,C6到D7,D7到E8)设置Tab顺序,然后在工作表中将单元格E5保留为下面的屏幕截图时,返回到B8。 如何实现它? 本文为您提供了一种VBA方法。

使用VBA代码设置单元格或未锁定单元格的Tab键顺序

Office选项卡在Office中启用选项卡式编辑和浏览,使您的工作更轻松......
Kutools for Excel - 最佳办公生产力工具将解决您的大部分Excel问题
  • 重用任何东西: 将最常用或最复杂的公式,图表和其他任何内容添加到您的收藏夹中,并在将来快速重复使用它们。
  • 超过20文本功能: 从文本字符串中提取数字; 提取或删除部分文本; 将数字和货币转换为英语单词...
  • 合并工具:多个工作簿和表格合二为一; 合并多个单元格/行/列而不丢失数据; 合并重复行和总和...
  • 拆分工具:根据价值将数据拆分为多个表格; 一个工作簿到多个Excel,PDF或CSV文件; 一列到多列......
  • 粘贴跳过 隐藏/过滤行; 数和总和 按背景颜色; 创建邮件列表和 通过Cell的价值发送电子邮件...
  • 超级过滤器: 创建高级过滤方案并应用于任何工作表; 排序 按周,日,频率等; 筛选 通过大胆,公式,评论......
  • 超过300强大的功能; 适用于Office 2007-2019和365; 支持所有语言; 在公司轻松部署; 全功能60天免费试用。

箭头蓝色右泡使用VBA代码设置单元格或未锁定单元格的Tab键顺序


请运行下面的VBA方法来设置正常工作表中的单元格的标签顺序或者在受保护的工作表中解锁单元格。

1。 在工作表中,您需要设置选项卡顺序,右键单击工作表选项卡并单击 查看代码 从上下文菜单。

2。 在里面 Microsoft Visual Basic for Applications 窗口中,将以下VBA代码复制并粘贴到 代码 窗口。

VBA代码:设置单元格或未锁定单元的Tab键顺序

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim tabArray As Variant
    Dim i As Long
    tabArray = Array("B5", "C6", "D7", "E8")
    Application.ScreenUpdating = False
    For i = LBound(tabArray) To UBound(tabArray)
        If tabArray(i) = Target.Address(0, 0) Then
            If i = UBound(tabArray) Then
                Me.Range(tabArray(LBound(tabArray))).Select
            Else
                Me.Range(tabArray(i + 1)).Select
            End If
        End If
    Next i
    Application.ScreenUpdating = True
End Sub

笔记:

1)在代码中,B5,C6,D7,E8是输入单元的顺序,并且必须使用单元格地址的大写字母。 你可以根据你的需要改变它们。

2)对于受保护的工作表,输入单元格必须解锁。

3。 按 其他 + Q 键关闭 Microsoft Visual Basic for Applications 窗口。

从现在开始,在B5中输入数据后,按下Tab或Enter键将光标移至C6,离开C7时移至D6,然后移至当前工作表中的D7,E8。


箭头蓝色右泡相关文章:


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Dan Maycock · 9 months ago
    Hello, is there a way to just hit enter without entering anything and have it go to the next selection?
  • To post as a guest, your comment is unpublished.
    Collins Neptali Arráiz López · 1 years ago
    No me funcionó, lo coloqué en la hoja de trabajo, debe haber algún error, me podrían ayudar, necesito implementarlo en mi trabajo,

    atte,

    Collins Neptali Arráiz López
  • To post as a guest, your comment is unpublished.
    Jeanne · 1 years ago
    Thanks for the code on enter order. I am working on a spreadsheet entering barcode information and I need to span up to 300 cells and the program only lets me enter 142 cells. Is there a way to add more so I can get up to 300?



    Thanks
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Hi Jeanne,
      Thanks for your comment.
      But the code can’t be optimized to meet your needs. Sorry about that.
  • To post as a guest, your comment is unpublished.
    Evan · 1 years ago
    First select which cells you want to have unprotected.

    When you protect your sheet it will automatically set the tab order according to your unprotected cells. It will Tab forward from Left to Right, and Top to Bottom; Shift+Tab backward from Right To Left, and Bottom to Top.
  • To post as a guest, your comment is unpublished.
    Nat · 1 years ago
    With the order that you have listed them excel does without VBA code. Make them go backwards then you got something.
  • To post as a guest, your comment is unpublished.
    Jeannie · 1 years ago
    Hello and thank you for the VBA code to set the tab order in a protected sheet where the form control labels and form control drop-down boxes are unlocked and the user can tab through and fill out the information in a label, and when tabbing to a drop down list select the number of items the instructions give him, and I have made progress with your code. At first I could only tab through each of the label form controls, now I sometimes hit the drop down lists. I would really enjoy a turorial on how tro do tis
  • To post as a guest, your comment is unpublished.
    Spinaz · 2 years ago
    Is it possible to use this same code to force tab across each row to each unprotected cell? I need to tab starting at cell A15, and then move to the next unprotected cell (C15), then E15, then G15. Once here, I need to tab to A16 and repeat the process for the remainder of the form. The reason I need this is that data is entered by barcode scanner, and some are programmed to tab, and others to enter. Thanks for your help on this.
    Spinaz
  • To post as a guest, your comment is unpublished.
    Spinaz · 2 years ago
    Can this be used to force a tab to the next unlocked cell in the worksheet? For example, I need the operator to enter (scan) data into cell A15, and then it should tab over to C15, then E15, then G15 (which is the end of the row), then return to the first cell in the next row, A16 and repeat the sequence. I need to force this pattern as some operators used scanners programmed to tab, and other are programmed to enter.
    Thanks!!