VBA基本

Option Explicit

Sub createStub()

'num変数の定義
Dim num As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer

 

Dim myMsg As String

'On Error GoTo HandleErr

'指定したセルの値を変数に代入する。
num = Worksheets("Sheet1").Cells(2, 4).Value

'ボタン押下すると変数の内容をメッセージボックスに表示させる
MsgBox ("こんばんは世界")




HandleErr:
myMsg = "エラー番号 : " & Err.Number & vbCrLf & _
"エラー内容 : " & Err.Description
'MsgBox myMsg

End Sub