Private Sub CommandButton1_Click() Dim a1 As Integer Dim d1 As Integer Dim r1 As Integer a1 = Sheet1.Cells(2, 3) d1 = a1 8 r1 = a1 Mod 8 If d1 >= 5 Then Sheet1.Cells.Range("A20:E20").Interior.Color = vbBlack Else For cnt = 1 To d1 Sheet1.Cells(20, cnt).Interior.Color = vbBlack Next cnt If r1 <> 0 Then Sheet1.Cells(20, cnt).Interior.Color = vbBlack Sheet1.Cells(20, cnt).Font.Color = vbWhite Sheet1.Cells(20, cnt) = (8 - r1) End If End If End Sub
Cells.Select Selection.Interior.ColorIndex = xlNone Cells(2, 3).Select Private Sub CommandButton2_Click() Dim a1 As Integer Dim d1 As Integer Dim r1 As Integer Cells.Select Selection.Interior.ColorIndex = xlNone Cells(2, 3).Select a1 = Sheet1.Cells(2, 3) d1 = a1 8 r1 = a1 Mod 8 If d1 >= 5 Then Sheet1.Cells.Range("A20:E20").Interior.Color = vbBlack Else For cnt = 1 To d1 Sheet1.Cells(20, cnt).Interior.Color = vbBlack Next cnt If r1 <> 0 Then Sheet1.Cells(20, cnt).Interior.Color = vbBlack Sheet1.Cells(20, cnt).Font.Color = vbWhite Sheet1.Cells(20, cnt) = (8 - r1) End If End If End Sub
DON'T MISS