以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  隐藏列名包含特定字符的列  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=93626)

--  作者:fubblyc
--  发布时间:2016/12/2 15:01:00
--  隐藏列名包含特定字符的列

不想显示所有同比环比占比的值,需要隐藏。

用的土办法,如下:如果有这个列,则隐藏,但是很多列,代码冗长。

有没有别的办法,比如遍历列,列名有包含gdr、stp、cle的,就隐藏这些列。

 

 

    \'If Tables(e.Form.Name & "_table1").Cols.Contains("总吊牌金额gdr") Then  
        \'Tables(e.Form.Name & "_table1").Cols("总吊牌金额gdr").Visible = False
    \'End If
    \'If Tables(e.Form.Name & "_table1").Cols.Contains("总吊牌金额stp") Then  
        \'Tables(e.Form.Name & "_table1").Cols("总吊牌金额stp").Visible = False
    \'End If
    \'If Tables(e.Form.Name & "_table1").Cols.Contains("总吊牌金额cle") Then  
        \'Tables(e.Form.Name & "_table1").Cols("总吊牌金额cle").Visible = False
    \'End If
\'
    \'If Tables(e.Form.Name & "_table1").Cols("VIP小票数gdr") Then  
        \'Tables(e.Form.Name & "_table1").Cols("VIP小票数gdr").Visible = False
    \'End If
    \'If Tables(e.Form.Name & "_table1").Cols("VIP小票数stp") Then  
        \'Tables(e.Form.Name & "_table1").Cols("VIP小票数stp").Visible = False
    \'End If
    \'If Tables(e.Form.Name & "_table1").Cols("VIP小票数cle") Then  
        \'Tables(e.Form.Name & "_table1").Cols("VIP小票数cle").Visible = False
    \'End If
\'
\'
    \'If Tables(e.Form.Name & "_table1").Cols("总小票数gdr")Then  
        \'Tables(e.Form.Name & "_table1").Cols("总小票数gdr").Visible = False
    \'End If
    \'If Tables(e.Form.Name & "_table1").Cols("总小票数stp") Then  
        \'Tables(e.Form.Name & "_table1").Cols("总小票数stp").Visible = False
    \'End If
    \'If Tables(e.Form.Name & "_table1").Cols("总小票数cle") Then  
        \'Tables(e.Form.Name & "_table1").Cols("总小票数cle").Visible = False
    \'End If

[此贴子已经被作者于2016/12/2 15:00:54编辑过]

--  作者:有点蓝
--  发布时间:2016/12/2 15:19:00
--  
遍历:http://www.foxtable.com/webhelp/scr/0561.htm


--  作者:fubblyc
--  发布时间:2016/12/2 15:31:00
--  

嗯嗯。谢谢!!

 

For Each c As Col In Tables("零售报表_table1").Cols
If c.name.EndsWith("stp") Or c.name.EndsWith("cle") Or c.name.EndsWith("glp") Then
c.Visible = False
End If
Next