简体   繁体   English

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 is a single cell and I would also like to apply the same context to a merged area including multiple cells. LocalCurAmount 是一个单元格,我还想将相同的上下文应用于包含多个单元格的合并区域。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM