2013年6月15日 星期六

Excel VBA可使用的56種顏色

在Excel VBA可使用的顏色只有56種,可參考以下
程式碼如下:
Sub VBAColor()
    Dim i As Integer
    For i = 1 To 56
        If i < 29 Then
            Cells(i, 1).Interior.ColorIndex = i
            Cells(i, 2) = i
        Else
            Cells(i - 28, 3).Interior.ColorIndex = i
            Cells(i - 28, 4) = i
        End If
    Next i
End Sub
畫面如下

沒有留言:

張貼留言