ユーザー定義関数を利用する:Excel VBA入門 |
スポンサードリンク | |
消費税 | 赤色のセルの合計 |
Function zei(myRng As Range) As Double Dim c As Range Dim goukei As Double Application.Volatile goukei = Application.WorksheetFunction.Sum(myRng) zei = Int(goukei * 5 / 100) End Function |
Function aka_goukei(myRng As Range) As Double Dim c As Range Dim goukei As Double Application.Volatile For Each c In myRng If c.Interior.ColorIndex = 3 Then '赤色 goukei = goukei + c.Value End If Next c aka_goukei = goukei End Function |
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Worksheets("Sheet1").Calculate End Sub |
スポンサードリンク
PageViewCounter
Since2006/2/27