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

Excelでアクティブセルのアドレスを取得するにはどうすればよいですか?

Microsoft Excelを使用しているときに、数式バーの左側にリストされている名前ボックスで現在選択されているセルの場所を簡単に取得できます。 ただし、セルに名前が付けられている場合、名前ボックスの表示に基づいてその場所を調べることはできません。 また、アクティブセルの完全なアドレスを直接表示したり、指定したセルのアクティブセルのアドレスを表示したりする場合は、どうしますか? このチュートリアルでは、数式とVBAメソッドを使用してアクティブセルのアドレスを簡単に取得する方法を示します。

数式でアクティブセルのアドレスを取得する
VBAコードでアクティブセルのアドレスを取得する
指定されたセル内のアクティブセルのアドレスをVBAコードで表示します
素晴らしいツールでアクティブセルのアドレスを動的に表示


数式でアクティブセルのアドレスを取得する

このセクションでは、アクティブセルのアドレスを簡単に取得する式を提供します。

1.セルを選択してアクティブにします。

2.以下の式を入力して、を押します。 入力します キー。

=ADDRESS(ROW(),COLUMN())

次に、現在選択されているセルのアドレスがセルにすぐに表示されていることを確認できます。

Note:別のセルを選択しても、アドレスは自動的に変更されません。 異なるセルを選択しながら動的アドレスを取得するには、以下の方法を適用してください。

アクティブセルのアドレスを動的に表示します。

  強化された編集バー の有用性 Kutools for Excel Excelのワークシートにアクティブセルのアドレスを動的に表示するのに役立ちます。 さらに、以下のデモに示すように、選択したセルのコンテンツをウィンドウで直接表示および編集できます。
今すぐダウンロードして試してください! (30日間の無料トレイル)


VBAコードでアクティブセルのアドレスを取得する

VBAコードでアクティブセルのアドレスを取得することもできます。 次のようにしてください。

1。 プレス 他の + F11 同時に開くには アプリケーション向け Microsoft Visual Basic 窓。

2。 の中に アプリケーション向け Microsoft Visual Basic ウィンドウで、左側のペインにある現在使用しているワークシートの名前をダブルクリックしてコードエディターを開き、以下のVBAコードをコピーしてコードエディターに貼り付けます。

VBAコード:アクティブセルのアドレスを取得します

Sub selectRange()
	MsgBox ActiveCell.Address
End Sub

3.次に、 ラン ボタンを押してコードを実行します。

4.次に、ダイアログボックスが表示され、内部にリストされているアクティブセルのアドレスが示されます。


指定されたセル内のアクティブセルのアドレスをVBAコードで表示します

別の状況では、アクティブセルのアドレスを指定されたセルに表示したい場合があります。 あるセルから別のセルに移動するたびに、セルアドレスが自動的に変更され、指定したセルに表示されます。 次のようにしてください。

1.を開いてください アプリケーション向け Microsoft Visual Basic を押してウィンドウ 他の + F11 同時に。

2.左側のペインでシート名をダブルクリックしてコードエディタを開き、以下のコードをコピーして貼り付けます。

VBAコード:指定したセル内のアクティブセルのアドレスを表示します

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
	Range("A1").Value = ActiveCell.Address
End Sub

Note:A1は、アクティブセルアドレスを配置するセルです。必要に応じて、指定したセルに変更できます。

3。 次に、をクリックします File > 閉じてMicrosoftExcelに戻る を終了する アプリケーション向け Microsoft Visual Basic 窓。

セルA1にアクティブセルのアドレスが表示され、アクティブセルの変更に応じてアドレスが自動的に変更されます。 スクリーンショットを参照してください:


素晴らしいツールでアクティブセルのアドレスを動的に表示

ワークシートにアクティブセルのアドレスを動的に表示したい場合は、 強化された編集バー のツール Kutools for Excel。 このツールがワークシートのアクティブセルのアドレスを動的に表示する方法を見てみましょう。

申請する前に Kutools for Excelについては 最初にダウンロードしてインストールします.

1。 クリック クツール > 表示と非表示 > 強化された編集バー この機能を有効にします。

これ以降、セルをクリックするたびに、[拡張編集バー]ウィンドウがポップアップ表示されます。 また、ウィンドウの下部にセルのアドレスが表示されます。
ヒント:ウィンドウでセルの内容を直接表示および編集できます。

  このユーティリティの無料トライアル(30日)が必要な場合は、 クリックしてダウンロードしてください、次に、上記の手順に従って操作を適用します。


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

🤖 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 (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bom dia,
Excelente formula para exibir a célula ativa.
Mas estou precisando utilizar o "conteúdo" de uma célula ativa dentro de uma formula SE.
Entao:

Se
"celula_ativa" = "aluno"
Retorna a seguinte informação "XXXX"
OU se for "professor"
Retorna a seguinte informação "YYYY"

Vc consegue me ajudar com isso, por favor?
This comment was minimized by the moderator on the site
I am fairly new to writing VBA.
Instead of reporting the message box with activated cell address, I would like to pull the cell address of an activated cell from my vba code and store it in a table/other location on the sheet for each iteration that my for loop takes.

How would I go about completing this task?


Regards,
This comment was minimized by the moderator on the site
The first example does not display the address of the active cell but of the cell containing the formula. If you were to select a different cell the address would not change.
Actually this is probably more useful information than gathering the active cell's address and harder to find if you need it. I was looking how to do this using VBA and could not find it for a while so I will include it here:

Application.Caller.Address

That will give you the address of the cell calling the function and not the active cell, useful for relative references.
This comment was minimized by the moderator on the site
Hello,

Displaying the active cell reference is helpful. But how do I actually use that value? I'm reading exams, and have six columns (of which two will get filled in). The student name is in column A; I can extract the family name: LEFT(A7,(FIND(",")A7)-1))) [where A7 is the current address]. I can use the code for displaying the current active cell address provided above:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = ActiveCell.Address
End Sub

But what I really want to do is have the cursor being somewhere in the current row (C3:H3), and extract the family name of the current student. Example:

A B C D E F G H
1 Name ID 1 2 3 4 5 6

2 Smith, John 1234567

When the active cell is between C1 and H1, I want to extract the student name from A2 ("Smith, John") [using LEFT(A2,(FIND(",")A2)-1)))], but with the values for the address supplied from the code above.

Any suggestions would be welcome.


Bill
This comment was minimized by the moderator on the site
Dear Bill,
If you want to use the cell reference of active cell, please apply below VBA code.
(The active cell reference will be displayed in cell A1. Then you can copy the cell reference directely in A1 or do other operations as you need.)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If (Target.Count = 1) And (Intersect(Target, Range("A1")) Is Nothing) Then
Range("A1").Value = ActiveCell.Address
End If
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations