VBA基本 Lesson5

問題と実行結果 Lesson5

VBA Basic Lesson5

問題1

Sub Lesson5_1_3()

    Dim i As Long

    For i = 2 To 31

        Cells(i, 4).NumberFormat = "#,##0"

        Cells(i, 4) = (Cells(i, 3) - Cells(i, 2)) * 500

    Next i

End Sub

問題2

Sub Lesson5_2_2()

    Dim i As Long

    For i = 2 To 31

        If Format(Cells(i, 3), "aaa") = "日" Then

            Cells(i, 5).NumberFormat = "#,##0"

            Cells(i, 5) = 1000

        End If

        Cells(i, 6).NumberFormat = "#,##0"

        Cells(i, 6) = Cells(i, 4) + Cells(i, 5)

    Next i

End Sub

※使用している内容は、「Office TANAKA」VBA Basic セミナー受講資料から許可を得て引用しております。
田中先生ありがとうございます。

Excel

前の記事

Excel条件付き書式
VBA

次の記事

VBA基本 Lesson6