以下是相关代码:
'hides all Location, Account, Product Line, or Sum of Total rows in column A
For Each c In r
If c.Text = "Location" Or c.Text = "Account" Or c.Text = "Product Line" Or _
c.Text = "Sum of Total" Then
c.EntireRow.Hidden = True
End If
Next c
问题在于它正在用A列中的大多数名称隐藏这些列,但是有两套未隐藏。(大约有15个数据透视表,而“位置”,“帐户”和“产品系列”都是过滤器;“总计”是空白行,但A列中的单个语句除外)
是什么原因造成的?
如果需要,我可以发布正在使用的完整代码,但是由于某种原因,它只是不读取两个特定数据透视表中的值。
编辑:更多代码
Set r = Range("a1:a1000")
'hides all rows with no value
For Each c In r
If Len(c.Text) = 0 Then
c.EntireRow.Hidden = True
Else
c.EntireRow.Hidden = False
End If
Next c
'unhides all the rows below each grand total row
For Each c In r
If c.Text = "Grand Total" Then
c.Offset(1).EntireRow.Hidden = False
End If
Next c
'unhides all rows below a row with a value
For Each c In r
If Len(c.Text) > 0 Then
c.Offset(1).EntireRow.Hidden = False
End If
Next c
'hides all Location, Account, Product Line, or Sum of Total rows in column A
For Each c In r
If c.Text = "Location" Or c.Text = "Account" Or c.Text = "Product Line" _
Or c.Text = "Sum of Total" Then
c.EntireRow.Hidden = True
End If
Next c
我已经解决了问题。c.Text
我没有使用c.Value2
它,而是解决了该问题。必须存在一些无法修复的内部格式化问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句