[英]Hide group of rows in excel
I want to hide certain group of rows where 1st row after blank row is "xyz" untill next blank row occours. 我想隐藏某些行组,其中空白行之后的第一行是“ xyz”,直到出现下一个空白行。 eg
例如
**heloo**
a
b
**xyz**
as
df
**hello**
g
j
**xyz**
ghj
gh
jk
jk
I want output to be as 我希望输出为
**heloo**
a
b
**hello**
g
Looks like you have edited your question a bit, so the inputs are slighty different. 看来您已经编辑了问题,所以输入内容略有不同。 However, this is the idea of what you need.
但是,这就是您需要的想法。 Basically, define a range.
基本上,定义一个范围。 Iterate through it until you find xyz.
遍历直到找到xyz。 Set a flag to start hiding every row in the iteration until you find a blank row.
设置一个标志以开始隐藏迭代中的每一行,直到找到空白行。
Sub HideRows()
Set r = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
hiderow = False
For Each c In r.Cells
If Left(c.Value, 3) = "xyz" Then
hiderow = True
ElseIf Len(c.Value) = 0 Then
hiderow = False
End If
If hiderow Then
c.Select
Selection.EntireRow.Hidden = True
End If
Next c
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.