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

Excelでセル値が範囲内で変化した場合にメッセージボックスをポップアップするにはどうすればよいですか?

特定のワークシートの範囲内の変更を思い出す必要がある場合があります。 したがって、セル値が特定の範囲で変更された場合は、ポップアップメッセージボックスが役立ちます。 この記事では、VBAメソッドを使用してこれを実現できます。

セル値がVBAコードの範囲内で変更された場合、メッセージボックスをポップアップします


セル値がVBAコードの範囲内で変更された場合、メッセージボックスをポップアップします

次のVBAコードは、セル値が特定のワークシートの指定された範囲内で変更された場合にメッセージボックスをポップアップします。 次のようにしてください。

1。 押す 他の + F11 キーを同時に開いて アプリケーション向け Microsoft Visual Basic 窓。

2。 の中に アプリケーション向け Microsoft Visual Basic ウィンドウで、左側のバーのシート名(指定された範囲が存在する)をダブルクリックして、 Code ウィンドウをクリックし、以下のVBAコードをコピーしてウィンドウに貼り付けます。

VBAコード:セル値が範囲内で変化した場合にメッセージボックスをポップアップします

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not (Application.Intersect(Range("A1:E19"), Target) Is Nothing) Then
        MsgBox "Cell " & Target.Address & " has changed.", vbInformation, "Kutools for Excel"
    End If
End Sub

Note:コードで指定された範囲A1:E19を必要な範囲に変更できます。

3。 押す 他の + Q 同時にキーを閉じて アプリケーション向け Microsoft Visual Basic 窓。

今のところ、範囲A1:E19のセル値が変更されると、メッセージボックスが自動的にポップアップ表示されます。 スクリーンショットを参照してください:

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

🤖 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
Hi everyone & thanks for help!!!!

How could I modify the VBA to show the excel cell informattion in MsgBox......?????
This comment was minimized by the moderator on the site
Hi everyone & thanks for help!!!!

How could I modify the VBA and say that if the Range B1:B50 is less than or equal to Range A1:B50 then MsgBox......?????
This comment was minimized by the moderator on the site
Good Day,
Do you mean the total sum of range b1:b50?
This comment was minimized by the moderator on the site
Hi everyone & thanks for the VBA.

I was just wondering how to modify the VBA in case that I want the MsgBox only if for example the cell value B1 is <= than A1


Thanks for your assistance!!!
This comment was minimized by the moderator on the site
Good Day,
Please try below VBA code:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ExitSub
Dim One As Long
Dim Two As Long
One = Range("A1").Value
Two = Range("B1").Value
If Not (Application.Intersect(Range("A1:B1"), Target) Is Nothing) Then
If (One > Two) Then
MsgBox "Range(""A1"") > Range(""B1"")", vbInformation, "Kutools for Excel"
End If
End If
ExitSub:
End Sub
This comment was minimized by the moderator on the site
Considering the above example.(VBA code: pop up message box if cell value changes within a range)

when the value of D14 has changed we get a pop up, in the similar way how to get the ID of that (column A of the same row (A14)).
Thanks in advance, any response is appreciable.
This comment was minimized by the moderator on the site
considering the above output there is a question.
we got a pop message when the D14 has changed, in the similar can way can we get the ID (data of the same row of the column A) in the pop up message??
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations