隐藏行中的数据 – Excel VBA

我有三行。我想隐藏在这些行中的数据,并以不同的颜色显示这些行。我试着search,但只发现Entirerow.hidden,这也隐藏了行号。 是否有可能只隐藏行中的数据,并使用其他颜色显示它?

下面的代码将第1到第3行的背景颜色更改为黄色。

Sub ChangeBackColorForSpecificRows() Rows("1:3").Interior.Color = 65535 End Sub 

更改行和内部颜色以适应您的要求。

编辑:-

formupahidden设置为true不工作既不格式化它的locking和隐藏,隐藏配方栏的内容 – Sunaina

复制下面的代码,并右键单击工作表选项卡,然后select查看代码并粘贴它。

closuresVBA窗口(Alt + QclosuresVBA窗口)并返回到该表并检查。

 Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Rows("1:3")) Is Nothing Then If Application.DisplayFormulaBar Then Application.DisplayFormulaBar = False Else If Not Application.DisplayFormulaBar Then Application.DisplayFormulaBar = True End If End Sub