実行画面
「アルバイト」ボタンをクリックした場合の画面です。
隣のセルにカーソルが移動しています。
実行VBAコード
'費目のセット
Private Sub ExHimokuSet(st As String, nno As Integer)
Dim s1 As String
If ActiveCell.Column = 4 Then
s1 = ActiveCell.Address
Range(s1) = st
ActiveCell.Offset(0, nno).Activate
Else
Beep
ActiveCell.Activate
End If
End Sub
Private Sub CommandButton1_Click()
ExHimokuSet CommandButton1.Caption, 1
End Sub
Private Sub CommandButton10_Click()
ExHimokuSet CommandButton10.Caption, 2
End Sub
Private Sub CommandButton11_Click()
ExHimokuSet CommandButton11.Caption, 2
End Sub
Private Sub CommandButton12_Click()
ExHimokuSet CommandButton12.Caption, 2
End Sub
Private Sub CommandButton13_Click()
ExHimokuSet CommandButton13.Caption, 2
End Sub
Private Sub CommandButton14_Click()
ExHimokuSet CommandButton14.Caption, 2
End Sub
Private Sub CommandButton15_Click()
ExHimokuSet CommandButton15.Caption, 2
End Sub
Private Sub CommandButton16_Click()
ExHimokuSet CommandButton16.Caption, 2
End Sub
Private Sub CommandButton17_Click()
ExHimokuSet CommandButton17.Caption, 2
End Sub
Private Sub CommandButton18_Click()
ExHimokuSet CommandButton18.Caption, 2
End Sub
Private Sub CommandButton19_Click()
ExHimokuSet CommandButton19.Caption, 2
End Sub
Private Sub CommandButton2_Click()
ExHimokuSet CommandButton2.Caption, 1
End Sub
Private Sub CommandButton20_Click()
ExHimokuSet CommandButton20.Caption, 2
End Sub
Private Sub CommandButton21_Click()
ExHimokuSet CommandButton21.Caption, 2
End Sub
Private Sub CommandButton3_Click()
ExHimokuSet CommandButton3.Caption, 1
End Sub
Private Sub CommandButton4_Click()
ExHimokuSet CommandButton4.Caption, 1
End Sub
Private Sub CommandButton5_Click()
ExHimokuSet CommandButton5.Caption, 1
End Sub
Private Sub CommandButton6_Click()
ExHimokuSet CommandButton6.Caption, 1
End Sub
Private Sub CommandButton7_Click()
ExHimokuSet CommandButton7.Caption, 1
End Sub
Private Sub CommandButton8_Click()
ExHimokuSet CommandButton8.Caption, 2
End Sub
Private Sub CommandButton9_Click()
ExHimokuSet CommandButton9.Caption, 2
End Sub