不知道 VBA 可不可以接受?
'注意:為了日期的可擴展性, 原 J1:J3 已移至 B16:B18
'請根據需要, 自行更改
Private Sub CommandButton1_Click()
Dim Ar
Dim R1 As Integer, C1 As Integer, LstC As Integer, CN As Integer
Dim MC As Integer, AC As Integer, EC As Integer
[B11:H13] = ""
LstC = [IV2].End(xlToLeft).Column
MC = [B16].Font.ColorIndex '上午顏色
AC = [B17].Font.ColorIndex '下午顏色
EC = [B18].Font.ColorIndex '晩上顏色
For R1 = 2 To 8
For C1 = 2 To LstC
If Cells(R1, C1) <> "" Then
CN = Cells(R1, C1).Font.ColorIndex
If CN = MC Then
Cells(11, C1) = Cells(11, C1) + Cells(R1, C1)
ElseIf CN = AC Then
Cells(12, C1) = Cells(12, C1) + Cells(R1, C1)
Else
Cells(13, C1) = Cells(13, C1) + Cells(R1, C1)
End If
End If
Next
Next
End Sub
[attach]22673[/attach]作者: K_Wing 時間: 2015-12-1 10:30