vba 如何使用VBA使Excel 2007中的单元格透明

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9116057/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 12:31:09  来源:igfitidea点击:

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

excelvbaexcel-2007transparencycell

提问by AJP

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 docsseem to suggest it doesn't exist (?).

但这会消除细胞的边界。相反,我只想将范围内的单元格的透明度设置为 1.0。 文档似乎表明它不存在(?)。

Thanks!

谢谢!

回答by Tim Williams

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

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

回答by safw

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

回答by Tom

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

也许一个简单的方法是(Symbol).(line or background)Color = -1 'Transparent.