Excel宏隐藏特定的单元格&合并区 [英] Excel Macro hide specific cell & merged area
问题描述
我试图根据另一个单元格的值隐藏特定单元格.到目前为止,我设法隐藏了整行,但无法隐藏特定的单元格.
I am trying to hide specifics cells based on the value of another cell. So far I manage to hide the entire row but is not able to hide specific cells.
Local Currency value show/hide item
If Range("Currency").Value = "USD" Then
Range("LocalCurAmount").EntireRow.Hidden = True
End If
到目前为止,我已经尝试过
So far I have tried
Range("LocalCurAmount").Hidden = True
Range("LocalCurAmount").Cells.Hidden = True
但是没有任何效果.我想隐藏这些特定的单元格并向上移动内容.
But nothing works. I would like to hide this specific cells and move the content up.
LocalCurAmount是单个单元格,我还想将相同的上下文应用于包含多个单元格的合并区域.
LocalCurAmount is a single cell and I would also like to apply the same context to a merged area including multiple cells.
推荐答案
您只能隐藏整行或整列,不能隐藏单个单元格,只能删除它们,如果删除范围,则可以移动细胞从侧面向上或向左
You can only hide a full row or full column, you can not hide individual cells, you can only delete them, if you delete a range, you can move cells up or left from the sides
为了删除;可以使用此语句
in order to delete; this statement can be used
Range("LocalCurAmount").Delete Shift:=xlUp
这篇关于Excel宏隐藏特定的单元格&合并区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!