1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Excel VBA入門  ボタン追加

Posted at

VBAでボタン作成

VBAでボタンを追加するには下の画像の様にまず開発タブのコントロールグループ内の挿入から
ボタン(フォームコントロール)をクリックします。
スクリーンショット 2019-10-09 17.30.04_LI.jpg

次にボタンの大きさをドラッグで指定します。
スクリーンショット 2019-10-09 17.34.32_LI.jpg

マクロの登録ウィンドウが出るのでマクロ名を入力してマクロの保存先を作業中のブックを選択して編集ボタンをクリックします。
スクリーンショット 2019-10-09 17.35.11_LI.jpg

するとVBEのコードのウィンドウへ遷移するのでそこでボタンをクリックした時の処理を記述します。
今回はSub btnMessage() MsgBox "ボタンクリック" EndSubと記述して
ボタンを押すと"ボタンクリック"と文字が別ウィンドウで表示されるようにしてます。
スクリーンショット 2019-10-09 17.35.23.png

スクリーンショット 2019-10-09 17.36.12.png

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?