メインコンテンツへスキップ

Excelでセルまたはロック解除されたセルのタブ順序を設定するにはどうすればよいですか?

たとえば、Tab キーを押すと、セル B5 から C6、C6 から D7、D7 から E8 に移動し、ワークシートのセル E5 を離れると B8 に戻ります。以下のスクリーンショットのように。 それを達成する方法は? この記事では、VBA メソッドを提供します。

VBAコードでセルまたはロック解除されたセルのタブ順序を設定する


VBAコードでセルまたはロック解除されたセルのタブ順序を設定する

以下のVBAメソッドを実行して、通常のワークシートのセルまたは保護されたワークシートのロック解除されたセルのタブ順序を設定してください。

1.タブの順序を設定する必要があるワークシートで、シートタブを右クリックし、をクリックします コードを表示 コンテキストメニューから選択します。

2。 の中に アプリケーション向け Microsoft Visual Basic ウィンドウで、以下のVBAコードをコピーして Code 窓。

VBAコード:セルまたはロック解除されたセルのタブ順序を設定します

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 窓。

これ以降、B5にデータを入力した後、TabキーまたはEnterキーを押してC6に移動し、C7を離れるとD6に移動し、現在のワークシートのD7、E8に移動します。


関連記事:

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (14)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have copied your code into my worksheet, but as soon as I close it and reopen it to use it again, the code is gone. How do I save this?
This comment was minimized by the moderator on the site
Hi Anita,
If you want to keep the VBA code for feature use, after adding the VBA code, save your workbook as an Excel Macro-enabled workbook as shown in the screenshot below. Then use the newly saved file in the future.
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/Excel_macro-enabled_workbook.png
This comment was minimized by the moderator on the site
Olá, o código VBA para definir a ordem das células desejadas funcionou perfeitamente. Eu percebi que para que ele funcione, é necessário entrar com um dado na célula e pressionar TAB ou ENTER.
PERGUNTA: Você tem como fazer este código percorrer todas as células (no meu caso são 31, sendo algumas vazias e outras com valores padrão) sem ter que entrar com dados nelas, somente pressionando TAB ou ENTER. Como eu tenho algumas células vazias e outras com valores, por padrão, eu gostaria de percorrer as células sem precisar entrar com dados em todas elas novamente, mas, somente alterando as células que forem preciso alterar.att

Text translated by Google Translator
Hello, the VBA code to set the order of the desired cells worked perfectly. I realized that for it to work, it's necessary to enter data into the cell and press TAB or ENTER.
QUESTION: You can make this code go through all the cells (in my case there are 31, some being empty and others with default values) without having to enter data in them, just pressing TAB or ENTER. As I have some empty cells and others with values, by default I would like to cycle through the cells without having to enter data in all of them again, but only changing the cells that I need to change.att

This comment was minimized by the moderator on the site
Hello, New here The VBA code works until I hit a Pull Down Box, I get to the first on make my selection , hit Tab and it moves to a locked cell, It acts like a cell I did not enter any data in. Any suggestions? GlennD24
This comment was minimized by the moderator on the site
Hello, is there a way to just hit enter without entering anything and have it go to the next selection?
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
Hi Jeanne,
Thanks for your comment.
But the code can’t be optimized to meet your needs. Sorry about that.
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
Dear Evan,
Thank you for sharing.
This comment was minimized by the moderator on the site
With the order that you have listed them excel does without VBA code. Make them go backwards then you got something.
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
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
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations