アメリカの大学生活---日記

ミネソタ州立大学ムーアヘッド校 会計学部を5月に卒業して帰国し、税務の仕事してます。

練習問題7(メッセージボックスの練習)メモ

 

excel-ubara.com

- 文字と文字の結合の場合は、&(アンパサンド)を使ってつなげる

- CntCount

excel-ubara.com

 

excel-ubara.com

 

excel-ubara.com

 

Sub Practice7()
  Dim i As Long
  Dim lngTotal As Long
  Dim lngCnt As Long
  lngTotal = 0
  lngCnt = 0
  For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
    Cells(i, 4) = Cells(i, 2) * Cells(i, 3)
    lngTotal = lngTotal + Cells(i, 4)
    lngCnt = lngCnt + 1
  Next
  MsgBox "合計:" & lngTotal & vbLf & _
    "平均:" & lngTotal / lngCnt, _
   vbOKOnly, "結果"
End Sub