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

Excelでデータの行をすばやく反転/反転するにはどうすればよいですか?

行のデータ順序を逆にしたり反転したりする必要がある場合、どうすればすばやく実行できますか? Excelはそのような操作をサポートしていないため、通常、VBAコードまたは他のExcelアドインを使用する必要があります。 そして、次のトリッキーなことが、Excelでデータの行をすばやく反転または逆にするのに役立ちます。

VBAを使用して、データの順序を水平方向に反転/反転します。

Kutools for Excelを使用して、データの順序を水平方向に反転/反転します。



矢印青い右バブル VBAを使用して、データの順序を水平方向に反転/反転します。

これは、行のデータ順序を水平方向にすばやく反転/反転するのに役立つ、きちんとしたVBAマクロです。

ステップ 1:を長押しします 他の + F11 Excelでキーを押すと、 アプリケーション向け Microsoft Visual Basic 窓。

ステップ 2:クリック インセット > モジュール、次のマクロをに貼り付けます モジュール窓。

Sub FlipRows()
'Updateby20131126
Dim Rng As Range
Dim WorkRng As Range
Dim Arr As Variant
Dim i As Integer, j As Integer, k As Integer
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Arr = WorkRng.Formula
For i = 1 To UBound(Arr, 1)
    k = UBound(Arr, 2)
    For j = 1 To UBound(Arr, 2) / 2
        xTemp = Arr(i, j)
        Arr(i, j) = Arr(i, k)
        Arr(i, k) = xTemp
        k = k - 1
    Next
Next
WorkRng.Formula = Arr
End Sub

ステップ 3:を押す F5 このマクロを実行するためのキーを押すと、操作する範囲を選択するためのダイアログが表示されます。スクリーンショットを参照してください。

doc-逆順8

ステップ4: イベント OK、次のような結果が表示されます。


矢印青い右バブル Kutools for Excelを使用して、データの順序を水平方向に反転/反転します。

Kutools for Excelさん 水平範囲を反転 ツールを使用すると、選択した行でデータの順序を水平方向にすばやく反転/反転できます。

Kutools for Excelには、300を超える便利なExcelツールが含まれています。 30日以内に制限なしで無料でお試しいただけます。 今すぐ入手.

ステップ 1:データを反転する行を選択します。

ステップ 2: クリック クツール > レンジコンバーター > 水平範囲を反転、スクリーンショットを参照してください:

doc-reverse-row-order3

次に、選択した行ですべてのデータの順序が逆になっていることがわかります。

doc-reverse-row-order4
-1
doc-reverse-row-order5

水平範囲を反転 この機能について詳しく知るために。


関連記事:

Excelでデータの列を垂直方向に反転/反転するにはどうすればよいですか?

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

🤖 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 (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
In response to Rodrigo, Fbkil:

The error occurs because when you cut and paste the macro text into the Excel VBA editor, there are non-printing characters hidden in the area where the macro rows are indented. Delete them and it will work.

Note: Solved by someone else, not me. Was tricky, as it looked like it should work, but didn't.
This comment was minimized by the moderator on the site
When I try to run this macro, I get the message "syntax error" with the command line "For j = 1 To UBound(Arr, 2) / 2" highlighted in red. Does anyone know how to fix it?
This comment was minimized by the moderator on the site
got the same error. update needed
This comment was minimized by the moderator on the site
Great tool, thanks so much for VBA - I transposed a column to rows first and then used your VBA for reversing - saved tons of time!
This comment was minimized by the moderator on the site
You flipped the column order not the row order as per the title.
This comment was minimized by the moderator on the site
Copy paste (transpose) the row to column. Add 1 to x on the column beside. Filter from largest to smallest and expand. Then copy paste result and transpose to row again
This comment was minimized by the moderator on the site
A quicker way would be be to copy your selection. Right click, choose paste special. Check the transpose button, hit ok and the rows and columns will be transposed. http://office.microsoft.com/en-us/excel-help/switch-transpose-columns-and-rows-HP010224502.aspx
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations