'*************************
'登録ボタンをクリック
'************************* Private Sub CmdToroku_Click()
'入力チェック
'項目
If cmbKomoku.Text = "" Or _
cmbKomoku.Text = "選択してください" Then
MsgBox "項目を選択してください"
Exit Sub
End If '内容
If txtNaiyo.Text = "" Then
MsgBox "内容を入力してください"
Exit Sub
End If
'金額
If IsNumeric(txtKingaku.Text) Then
Else
MsgBox "金額を数字で入力してください"
Exit Sub
End If
'入力フォームの内容をsheetに編集
Dim row_cnt As Long
'未入力のrowを確定
For row_cnt = 5 To 200
If Cells(row_cnt, 1) = "" Then
Exit For
End If
Next row_cnt
'入力フォームの各項目をsheetに編集
Cells(row_cnt, 1) = frmMoneyDiary.txtDate
Cells(row_cnt, 2) = Mid(frmMoneyDiary.lblWeek, 2, 1)
Cells(row_cnt, 3) = frmMoneyDiary.cmbKomoku
Cells(row_cnt, 4) = frmMoneyDiary.txtNaiyo
If frmMoneyDiary.lblSyushiKubun = "収入" Then
Cells(row_cnt, 5) = Format(frmMoneyDiary.txtKingaku, "#,##0")
Else
Cells(row_cnt, 6) = Format(frmMoneyDiary.txtKingaku, "#,##0")
End If
'罫線を引く
With Range(Cells(row_cnt, 1), Cells(row_cnt, 6)).Borders
.LineStyle = xlContinuous
End With
'入力フォームを閉じる
Unload Me
End Sub