シートにボタンを作り、Wクリックしてください。
こうなります。
Private Sub CommandButton1_Click()
End Sub
この二行の間に挿入します。
Dim m_str_Hensuu As String
m_str_Hensuu = "適当な文字列"
MsgBox m_str_Hensuu
Private Sub CommandButton1_Click()
End Sub
Dim m_str_Hensuu As String
m_str_Hensuu = "適当な文字列"
MsgBox m_str_Hensuu
Private Sub CommandButton1_Click()
Dim hairetu As Variant
Dim i As Long
Dim maxnum As Long
hairetu = Array("11", "99", "22", "33", "44")
maxnum = -1
For i = 0 To UBound(hairetu)
If hairetu(i) > maxnum Then
maxnum = hairetu(i)
End If
Next i
MsgBox maxnum
End Sub
Private Sub CommandButton1_Click()
Dim hairetu As Variant
Dim i As Long
Dim n As Long
hairetu = Array("11", "22", "33", "44", "55")
For i = 0 To UBound(hairetu)
n = n + hairetu(i)
Next i
n = n / (UBound(hairetu) + 1)
MsgBox n
End Sub
Private Sub CommandButton1_Click()
Dim hairetu As Variant
Dim i As Long
Dim n As Long
hairetu = Array("課長", "部長", "係長", "副課長", "課長", "部長")
i = 0
n = 0
For i = 0 To UBound(hairetu)
If hairetu(i) = "課長" Then
n = n + 1
End If
Next i
MsgBox n
End Sub
Dim hairetu As Variant hairetu = Array("a", "b", "c", "d", "e", "f")
For i = 0 To 5
MsgBox hairetu(i)
Next
Dim hairetu As Variant
Dim i As Long
hairetu = Array("a", "b", "c", "d", "e", "f")
For i = 0 To 5
If hairetu(i) = "f" Then
MsgBox "見つかりました"
End If
Next
Private Sub CommandButton1_Click()
Dim i As Long
Dim wa As Long
' 初期化。
i = 0
wa = 0
' ループ開始。
For i = 1 To 5
wa = wa + i
Next
' セル番地A1に変数waの現在値を表示。
Range("A1").Value = wa
End Sub