How to use VBA to make a cell in Excel 2007 transparent

怎甘沉沦 提交于 2019-12-04 02:47:13

问题


I currently have:

Range("Z1").Interior.Color = RGB(255, 255, 255)

But this wipes out the borders of the cells. Instead I'd just like to set the transparency of the cells in range to 1.0. The docs seem to suggest it doesn't exist (?).

Thanks!


回答1:


Range("Z1").Interior.ColorIndex = xlNone




回答2:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    Application.ScreenUpdating = False
    ' Clear the color of all the cells
    Cells.Interior.ColorIndex = 0
    With Target
        ' Highlight the entire row and column that contain the active cell
        .EntireRow.Interior.ColorIndex = 8
        .EntireColumn.Interior.ColorIndex = 8
    End With
    Application.ScreenUpdating = True
End Sub



回答3:


Perhaps a simple approach would be (Symbol).(line or background)Color = -1 'Transparent.



来源:https://stackoverflow.com/questions/9116057/how-to-use-vba-to-make-a-cell-in-excel-2007-transparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!